the difference between 360 and 0 ???
the difference between 360 and 0 ???
Well in linear math its 360 but if your tracking the delta in roatation in degrees then well its 0. If you doing a prediction filter and taking the delta in the last five points of rotation and predicting the rotation its a monster of a problem. I could work up a series of statements to correct this but it seems very long and clock cycle eating. I know there is an easy solution to this just not sure what it is.
-
- Posts: 63
- Joined: Thu Aug 05, 2004 9:40 am
- Location: Germany
if ((rotX5-rotX4)>300 || (rotX5-rotX4)< -300){
if (rotX5 > rotX4) {
StarDeltaRotX += ((((rotX5-rotX4)-360)/Tdelta4)*FilterWeight4);
}
if (rotX5 < rotX4) {
StarDeltaRotX += ((((rotX5-rotX4)+360)/Tdelta4)*FilterWeight4);
}
}
else {StarDeltaRotX += (((rotX5-rotX4)/Tdelta4)*FilterWeight4);
This is a the code sample that im using to detect the transistion across 0 degrees. Its a bit clunky and assumes you will not move more then 60 degrees in a single calc.
rotX is rotation in x axis in degrees
Tdelta is the difference in time between the two points 4 and 5
StarDelta is the net change in degrees intergrated with time and the weight of this posistion in the filter.
Ive been to busy to get back to this section of code with putting in the physics section of our little project. But I will get back to it. Soon(TM).
if (rotX5 > rotX4) {
StarDeltaRotX += ((((rotX5-rotX4)-360)/Tdelta4)*FilterWeight4);
}
if (rotX5 < rotX4) {
StarDeltaRotX += ((((rotX5-rotX4)+360)/Tdelta4)*FilterWeight4);
}
}
else {StarDeltaRotX += (((rotX5-rotX4)/Tdelta4)*FilterWeight4);
This is a the code sample that im using to detect the transistion across 0 degrees. Its a bit clunky and assumes you will not move more then 60 degrees in a single calc.
rotX is rotation in x axis in degrees
Tdelta is the difference in time between the two points 4 and 5
StarDelta is the net change in degrees intergrated with time and the weight of this posistion in the filter.
Ive been to busy to get back to this section of code with putting in the physics section of our little project. But I will get back to it. Soon(TM).
I get the true rotation from the server. Its the rotation of other players that are to be drawn on the current client. If i draw the raw data it will get really jumpy so i filter the data with simple prediction. The prediction gets cofused when a rotation goes around from near 0 to 360. That is why i have to detect when the rotation crosses 0 and adjust for it, else cattywaumpus is the result. i dont think i could just send packets of rate of change as timing and other stuff would build up and create a delta between the clients on true rotation and position. Not sure there is a better way to do this but there should be. Maybe i should be conveting to radians or somthing.T101 wrote:You're taking the effective rotation to determine the rotation rate?
Why?
Presumably the rotation is changed as a result of something else. User input, something AI related or physics.
Surely all of these things have something to get the rotation rate from directly?
And you might also want to have a look at this thread:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=4360
Scroll down a bit for a discussion on replication as used by UnrealTournament.
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=4360
Scroll down a bit for a discussion on replication as used by UnrealTournament.
Here's my solution to the problem,
but don't expect too much, 'cattywaumpus' is here also the case. I've got many gray hairs on that.
but don't expect too much, 'cattywaumpus' is here also the case. I've got many gray hairs on that.
Code: Select all
f32 t = (timeMs-StartTime) * Speed;
f32 length_new = cos(t);
if (length_old < length_new)
{
if (trigger) {
// Do something...
trigger = false;
}
} else {
trigger = true;
}
length_old = length_new;
-
- Posts: 63
- Joined: Thu Aug 05, 2004 9:40 am
- Location: Germany
sorry
the previous post was mine...
your talking about a full vector3df so that 3 floats (might use signed ints and convert back) but anyway that times 100 players in same map is a buttload. When your talking about keeping track of over 100 ships at one time every tiny bit counts.Anonymous wrote:How about having the server send both the actual current rotation and the current rotation rate then? You can't ever deduce better information on the client than the server already has available, and it's only a couple of bytes.
The system im using seems smooth and saves me some bandwidth. Im going to need alot of it.
Im not sure we are on the same subject can you put some comments on that its making my head hurt even more since ive been messing with particles in the engineAnonymous wrote:Here's my solution to the problem,
but don't expect too much, 'cattywaumpus' is here also the case. I've got many gray hairs on that.
Code: Select all
f32 t = (timeMs-StartTime) * Speed; f32 length_new = cos(t); if (length_old < length_new) { if (trigger) { // Do something... trigger = false; } } else { trigger = true; } length_old = length_new;