Page 1 of 1

the difference between 360 and 0 ???

Posted: Sat Nov 06, 2004 8:48 am
by Yokom
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.

Posted: Sat Nov 06, 2004 4:55 pm
by Thulsa Doom
Have also a problem with 'predicting' rotation degree of a custom SceneNodeAnimator. As animators are called on render event there's not necesarilly a fixed time interval. Is this similar to your problem?

Posted: Mon Nov 08, 2004 3:22 pm
by Yokom
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).

Posted: Wed Nov 10, 2004 9:18 am
by T101
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?

Posted: Thu Nov 11, 2004 6:08 am
by Yokom
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?
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.

Posted: Thu Nov 11, 2004 9:32 am
by Guest
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.

Posted: Thu Nov 11, 2004 9:41 am
by Guest
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.

Posted: Thu Nov 11, 2004 12:34 pm
by Guest
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;

sorry

Posted: Thu Nov 11, 2004 12:37 pm
by Thulsa Doom
8) the previous post was mine...

Posted: Sat Nov 13, 2004 2:48 am
by Yokom
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.
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.

The system im using seems smooth and saves me some bandwidth. Im going to need alot of it.

Posted: Sat Nov 13, 2004 2:53 am
by Yokom
Anonymous 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;
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 engine