Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / EZ Rotate (Rotate To)

Author
Message
NickH
15
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 20th May 2009 13:12
Hi people, I'm just experimenting with EZ Rotate. I'm only trying to figure stuff out right now so this isn't part of a massive project just yet. All I'm trying to do is make one object rotate to face another object, then move towards it. At the moment the cube will turn to face the sphere, but it seems to be facing it with the wrong side. I don't understand why it would face the other object with an odd axis. When I add the move command it of course going off in the wrong direction and is closer to orbiting the object than going to it. I've looked through the examples and this version (though almost identical to my previous attempt) is a simple copy n paste of what was used in some working code. Not sure I got it all though of course.

make object box 1,0.5,0.5,1
make object sphere 2,1,7,7
position object 2,10,0,10
do
EZro_SetupFromObject 1
EZro_SetEuler OBJECT ANGLE X(1),OBJECT ANGLE Y(1),OBJECT ANGLE Z(1)
EZro_SetPos OBJECT POSITION X(1),OBJECT POSITION Y(1), OBJECT POSITION Z(1)
EZro_RotateTo 1,OBJECT POSITION X(2),OBJECT POSITION Y(2), OBJECT POSITION Z(2),3
EZro_FindEuler
ROTATE OBJECT 1,EZro_GetEulerX(),EZro_GetEulerY(),EZro_GetEulerZ()
MOVE OBJECT 1,1
control camera using arrowkeys 0,0.5,0.5
sync
Loop
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th May 2009 19:38
If you use SetEuler and SetPos, you don't need the SetupFromObject command.

If you want it to only turn on the Y axis, then use the TurnTo command.

NickH
15
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 20th May 2009 19:46
Hi KIStech,

I've removed the 2 unrequired lines, thanks. I hadn't realised. I'm new to EZ rotate. I want it to turn towards it on all axis in 3D space and go towards it. Removing those lines still gives the same effect. I want it to move along the object's Z axis towards the other object.

Thanks
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th May 2009 22:35 Edited at: 20th May 2009 22:46
I've been working with EZRotate for over a year, so I've learned some of the little tricks.

Give this a try..



This waits until the Y angle is small enough, then it starts moving, which makes the results of your testing a little easier to interpret. It may still be turning on other axies, but it will be a lot closer to facing the target before it moves.

NickH
15
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 20th May 2009 23:40
Thanks. I hadn't even got to that part. That sort of stuff was going to happen once I got over my initial problem
NickH
15
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 21st May 2009 13:42
After a little bit of experimenting it seems that the +Y Axis is the side that seems to point at the other object. In the example that I used for help it seems to work using the standard move command so obviously faces in the right direction on the correct axis. Anyone have any ideas?
NickH
15
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 23rd May 2009 13:34
False alarm. I've just had a look through the help file AGAIN. Just realised I hadn't noticed that the first parameter for the RotateTo command defines which axis should point towards the target. I've made it work!

Login to post a reply

Server time is: 2024-03-29 02:12:09
Your offset time is: 2024-03-29 02:12:09