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.

Author
Message
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 3rd Apr 2013 01:12 Edited at: 3rd Apr 2013 01:27
Does anyone know why if you move object at high speed it start to flicker?That's what you see if you follow it with a camera.I want to avoid that if possible.It happens to get worse when the object goes further from 0,0,0 position.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 3rd Apr 2013 08:00
LOOP OBJECT ?

try the sample code which I attached.

windowsXp

Attachments

Login to view attachments
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 3rd Apr 2013 14:53 Edited at: 3rd Apr 2013 17:26
It's move object.You show me good example of something irrelevant.How to explain myself more clear.Make object set camera to follow it move it with move object command using high value 1000 or 10000 get your popcorn and watch.It flicker.I think it's camera issue.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Apr 2013 19:57
It'll be caused by floating point inaccuracies at large position values. I'd strongly suggest you not move objects by such high values. Scale your objects down and move them by a much smaller amount.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 3rd Apr 2013 21:04 Edited at: 3rd Apr 2013 21:08
As it seems it's not the speed that cause this.I scalled down the object to original size.1000 times smaller than before, make it move with speed of 10 after it travels arround 10000 units of distance it begin to flicker again.I try to make sci fi game where you travel in space.Traveling in space need space, so this is impossible limitation.Not only that it flicker but the camera clip my object although it's not even close to it.How to make more accurate camera?

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 3rd Apr 2013 21:36
you can adjust the camera's range to suit your scale, this can help, but ultimately you can only go so far from the camera before you get clipping and z fighting issues

Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Apr 2013 23:51
Just a little theory to back up the above comments; you have 7 digits of precision; floats are single precision; here are examples of single precision numbers:

100.1275
129999.2
23.32123
299922.1

When you exceed the maximum range the system can understand as Mobiius said you will get inaccurate results. As stated, keep it small.

If your comfortable with taking on a challenge, wrap the coordinates; a bit like what mario does in some of the old single screen platform levels, when he goes passed the screen, he ends up on the opposite side; only you do it in 3D and put everything the player sees on the other side also. If uncertain what wrapping means, let us know.

But that's a bit advanced; keeping it small is easier.

luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 4th Apr 2013 14:58
Keeping it small might not be sufficient enough, tell me more about wraping please.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Apr 2013 19:06 Edited at: 4th Apr 2013 19:16
In a nutshell, IF position = 10000, the position must be put back to 0; IF the position = 10010, the position must be put back to 10; 10000 - 10000 = 0, 10010 - 10000 is 10 respectively.

In programming terms, it is best to install Matrix1 utilities and run the following command on all moving objects, and if you wanted dynamic content, all objects:



And in a practical scenario:



Now no object will ever go beyond your map edge and will be wrapped into place.

The code above was noob style, if you felt up for it you could do it Chris Tate style, in my world most things are never limited to one instance, and all objects belong to some kind of group:



Test the above code and move the camera, see what happens to you when you get to the edge of the map.

And if you are anal about performance like me; put objects that have actually moved in a given group and update those ones, then remove them from that group back into the original group; no need to update objects that don't need updating..

The principle is to keep the map size small enough to leave two or tree decimal points, for precise movement within the 7 digits you have to play with. The world might need to be a bit smaller if using Physics simulators.

Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Apr 2013 20:37
Or you could split your interpretation of space into sectors, and have each sector stand alone, so when you move from one sector to another, you reset the players position to one edge of the new sector. Like cells.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 4th Apr 2013 23:56
I thought about a way to shift all other objects positions in space in such a way as if i move the ship.Because i want to use some of the objects as landmarks and they should be marked no matter if they are actually visible or not 100 units away or 10000000.

Now if the player click on the sprite representing the object in space it turn the ship toward this object and move to it.You might say it's like wire travel, there is no free roam to distant objects.

I believe if dummy object is created to desired destination and pointed to ship and moved with the speed of the ship and every landmark object retain it's position relative to dummy object it will look like if the ship is moving.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 9th Apr 2013 20:53
Here it is a demo.I solve the problem the way i described in the previous post.It looks like if the sphere is moving and the camera is folowing but actually everything else is moving.It doesn't look very elegant with small objects, because it make objects tremble a bit,but since i'm gonna use it for planets and this kind of stuff it's ok.



Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 10th Apr 2013 02:26
If it looks good it is good.

I'm not sure why you didn't keep it simple and put things where they need to go with double floats and wrap the result like I demonstrated; but if this works and runs then you've cracked it either way.

Login to post a reply

Server time is: 2025-05-18 07:34:06
Your offset time is: 2025-05-18 07:34:06