Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 5,207 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
replay system -> euler angle interpolation #44102
04/11/05 13:40
04/11/05 13:40
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
i tried to write a replay system.

the script records the positions and rotations of physics entities at a specific sample rate. doing the playback is much harder than i thought though. to get good results i have to interpolate positions and rotations so that i can record/playback smoothly at any frame rate.

how should i do the interpolation of the euler angles though? the physics engine always outputs angles in the -180..180 range. with fast spinning objects (like car wheels) it's hard to say in which direction i should interpolate. for example the angle can be -175 in one frame and 175 in the next. i don't know if the angle difference is meant to be 10 or 350 degrees then.

how does something like that usually get done? i wasn't able to think of a really robust way to do this (i thought of motion prediction and things like that).

should/could this be better done with quaternions?
isn't a robust way possible at all with the limited rotational information i have?

Re: replay system -> euler angle interpolation [Re: ventilator] #44103
04/11/05 17:45
04/11/05 17:45
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:

how should i do the interpolation of the euler angles though? the physics engine always outputs angles in the -180..180 range.




Huh. Did not know that. Could you give me a quikie primer on euler angles within the 3DGS PE?

Quote:

with fast spinning objects (like car wheels) it's hard to say in which direction i should interpolate. for example the angle can be -175 in one frame and 175 in the next. i don't know if the angle difference is meant to be 10 or 350 degrees then.





In principle you should be able to create a routine that stores a record of previous velocities and add this information into the interpolation. Thus based on past velocity history, you calculate an idea of the future velocity and then determine whether 10 or 350 degrees makes more sense as the next angular position.

Re: replay system -> euler angle interpolation [Re: fastlane69] #44104
04/11/05 17:56
04/11/05 17:56
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
i guess internally physics uses quaternions (or matrices) and then it just converts them to eulers for c-script or the 3d engine.

Quote:

Thus based on past velocity history, you calculate an idea of the future velocity and then determine whether 10 or 350 degrees makes more sense as the next angular position.


yes, i have thought about that but there are cases where this could fail (like collisions with abrupt changes of rotation).

Re: replay system -> euler angle interpolation [Re: ventilator] #44105
04/11/05 18:30
04/11/05 18:30
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Keep in mind however it's exactly abruptness that Physics and thus Physics Engines don't deal well with. In Physics these are the dreaded discontinuities and there are no easy solutions for those.

In cases of collision, you would need to do a full on physical analysis of the system to do any kind of interpolation. Sounds like more trouble than it's worth for your purposes of a Replayer

Thus in your example, some alternatives might be that the collision would trip some internal flag or start an alternative routine to save the information you need. Or perhaps you need to record acceleration instead of or in addition to velocity. Or simply accept the disconinuity and work to minimize it instead of eliminating it.

Re: replay system -> euler angle interpolation [Re: fastlane69] #44106
04/11/05 23:01
04/11/05 23:01
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
Internally all objects need position and velocity information, so you would have to store these as well. Interpolating Euler angles is not a good idea. The proper way of doing things would be to convert them to quaternions and interpolate between those and convert them back to Euler for 3DGS. Using angular velocity (phent_getangvelocity) information should help you decide which way to rotate an object. E.g. if the angle between a normalized angular velocity vector of frame 1 and frame 2 is larger than say 90 degrees then some discrete event (collision) has occured.

Re: replay system -> euler angle interpolation [Re: Marco_Grubert] #44107
04/12/05 03:06
04/12/05 03:06
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
To retrieve 360 degree readings for your physics engine angles - if(my.pan < 0){my.pan += 360;}

To find the positive force on your wheels -
phent_getvelocity(my, temp, vector(250,250,0));
temp = abs(temp);

To find magnitude of velocity -
phent_getvelocity(my, temp, nullvector);
temp = vec_length(temp);

To find angular velocity -
phent_getangvelocity(you, temp);

You probably already know these commands well enough, but just in-case. If you end up working this out, please share how you accomplished it; I'd be very interested to know what you've done. Thanks.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1