Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)

 MSU4Life 02-07-2009 12:28 PM

Completely lost.....

New to Alice, had a in my lab for the class the other day and now 3 days after I failed to complete the work in class I am still racking my brain. This is no longer for a grade, only for future reference.

Our TA designed a program that had a kangaroo hop twice and land on a box. The initial distance from the kangaroo to the box is set to 6 meters. Each hop covers 2 meters and the landing covers 2 meters. I have to create a variable that allows the hops and landing to cover the right distance regardless of the position of the box from the kangaroo.

Any help would be greatly appreciated.

 DrJim 02-07-2009 09:43 PM

1 Attachment(s)
Actually not a trivial problem, though it looks easy at first glance. Perhaps the attached will help - though don't be surprised if it doesn't work without some tweaks. Also don't hesitate to ask your TA for help.

The variable part is simple in principle - just use the distance to function divided by three. Catch 1 - "distance to" is always measured from an objects local axis origin - which is defined differently for different objects - so make sure you know where that point is for the pair of objects you are using.

Catch 2 - you need to use the "turn to face" command rather than the point at command if you are going to use the "move forward" command. The Dunn, et al text has a nice example showing the difference.

Catch 3 is similar to the first - you need to make sure that the up directions for the two objects is the same. (It really doesn't matter for the cube - but does if you use the box shape or something similar.)

Good luck. :)

 All times are GMT -5. The time now is 10:19 PM.