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.

DarkBASIC Professional Discussion / New to DarkBasic, question regarding 3D rotation

Author
Message
DBB
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 9th May 2011 08:53
Hi,

I am currently editing a code for a swarm movement simulation.

I basically have x,y, and z coordinates stores for each unit of the swarm for a series of iterations.

I am trying to rotate my 3D object in the direction of propagation. How do I go about doing this?

I have tried to point the 3d object to the next position (x,y,z) but that didnt work. I have also tried calculating the angles between the first position and the next position and the scale factor of my object and then rotated using XYZrotate but that didnt work either.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 9th May 2011 12:01
With the right code any of those solution should have worked...

It's a bit harsh to say "that didn't work, the end" with no more explanaition / code.

-In.Dev.X: A unique heavy story based shoot'em ~25%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th May 2011 15:25
Could be you are closer than you think. If you share your code we might be able to help.

As Quel said it sounds like you are thinking roughly in the right direction.

One way to turn towards something is to save you object's rotation then use "Point Object" to point it at the ideal direction, then use a fraction of the difference between the angles to turn part way towards the ideal. Quick example (untested):

The only problem is that object rotation is slightly more complicated than that in DBP and you'll find your objects might turn around 350 degrees to the left instead of just 10 degrees to the right. It might help to get you started though...

Login to post a reply

Server time is: 2026-07-10 23:13:04
Your offset time is: 2026-07-10 23:13:04