the difference between 360 and 0 ???

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Yokom
Posts: 30
Joined: Sat Oct 09, 2004 10:50 pm

the difference between 360 and 0 ???

Post 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.
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

Post 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?
Yokom
Posts: 30
Joined: Sat Oct 09, 2004 10:50 pm

Post 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).
T101
Posts: 44
Joined: Thu Jul 29, 2004 4:41 pm

Post 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?
Yokom
Posts: 30
Joined: Sat Oct 09, 2004 10:50 pm

Post 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.
Guest

Post 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.
Guest

Post 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.
Guest

Post 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;
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

sorry

Post by Thulsa Doom »

8) the previous post was mine...
Yokom
Posts: 30
Joined: Sat Oct 09, 2004 10:50 pm

Post 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.
Yokom
Posts: 30
Joined: Sat Oct 09, 2004 10:50 pm

Post 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
Post Reply