PDA

View Full Version : how to write the code for creating the human in the box randomly.


maxarus
03-20-2008, 07:03 AM
how to write the code for creating the human in the box randomly.

http://www.freewebs.com/poppinny/3d.gif

Why this my code is error
p =[1,1,0]
a =[10,25,0]

x = 5

for i = 1 to x do

(

box_copy = copy $human

box_copy pos:(random p a)

)

Thank you

thatoneguy
03-20-2008, 08:09 AM
pos:[x,y] is for when you're executing a function or defining a struct.

example:

struct human (pos)
bob = human pos:[5,5]


or in the case of a function:


fn CreateHuman pos:[0,0] =
(
bob = copy $human
bob.pos = pos
)

createhuman pos:[10,5]


To just set the position of a node you have to call up the property .pos and assign it a value.

p =[1,1,0]
a =[10,25,0]
x = 5
for i = 1 to x do
(
box_copy = copy $human
box_copy.pos = (random p a)
)

maxarus
03-20-2008, 10:37 AM
I don't understand this answer . I am fool . Help me Please

Thank you again!!

arketip
03-20-2008, 11:58 AM
It is just a problem of syntax

box_copy pos:(random p a)
is not correct... This syntax is only correct when you create a new object.

And:
box_copy.pos = (random p a)
is correct after the creation of your object.

CGTalk Moderation
03-20-2008, 11:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.