I've having some difficulty with a script I have that I wrote to create a carousel of sorts.
Here's an image to give you the idea:
http://s1037.photobucket.com/albums/a455/RenickXY/?action=view¤t=Geck_Carousel.jpg
The Targets go around the circle conveyor belt, shoudld be simple. Or so I thought.
There is a center object(which will eventually be invisible), from which the target get there angles, I then you the angles and the radius(96) to determine the position.
the math I was using was:
PosX = (cos AngleZ) * 96 + OriginPosX
PosY = (cos AngleZ) * 96 + OriginPosY
I started out having a rotate,z command on the center object, that way the angle would be constantly changing, rotating the carousel of targets. However the targets did not move, and ironically they did not move at all, including animating when shot.
I then left the center object static and used a getHeadingAngle command in the script for the targets. Again same result.
Here is the code for the Target, which uses the getheading method:
scn SIMTargetCarousel1SCRIPT2short statefloat PosXfloat PosYfloat angleZbegin OnHitWith set Simrangem01Button.score to (Simrangem01Button.score + 1 ) if isAnimPlaying == 0 playgroup forward 1 endifendBegin GameMode if state == 0 set AngleZ to (getheadingAngle SIMrangeM01CarouselControllerRef) set AngleZ to (AngleZ + 180);GetHeadingAngle returns (-180 - 180) set state to 1 endif If SIMrangeM01Begin == 1; This is global is set to true when the challenge begins, which is obviously true(due to messages) if AngleZ >= 360 set AngleZ to 0 endif set PosX to ( (sin AngleZ) * 96 + SIMrangeM01CarouselController1.getpos, X) set PosY to ( (sin AngleZ) * 96 + SIMrangeM01CarouselController1.getpos, Y) setpos, x PosX setpos, y PosY set AngleZ to (AngleZ + 1);increase the rotation endifend
if anyone out there can offer a little assistance in deciphering the problem, it woudl be greatly appreciated.