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 Discussion / How to Rotate an object around all axises without the wabling effect?

Author
Message
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 28th Feb 2004 02:32
Im in the middle of writing a car simulator and everytime the car rotates about all axis, if wables. I tried reversing the order of rotation but the freaking thing keeps wabling. Can someone give me a solution. I'll really appreciate it. Thanks in advance.
Douglass
21
Years of Service
User Offline
Joined: 28th Aug 2003
Location:
Posted: 28th Feb 2004 02:43
Tim Ballisto
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 28th Feb 2004 04:24
you could try syncing or using the xrotate : yrotate : zrotate
i don't know if that will work though (i'm a novice)
zane
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: manchester, england
Posted: 28th Feb 2004 18:59 Edited at: 28th Feb 2004 19:00
ive had this problem, and it is to do woth the sync.
just before the main loop starts put "sync on"
then at the end of every loop where somthing needs to change on the screen, type in "sync". that way the screen is updated only when you want it to and the wobbeling effect stops.
click on the source button to view the code

www.zaneproductions.tk - lots of games, no Dark basic ones though (yet)!
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 29th Feb 2004 12:48
You should only "sync" ( update the screen ) once every loop, otherwise your gonna kill your frame rate, and It'll make everything extremely choppy...

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 1st Mar 2004 02:25
OH BOY
THANKS FOR ALL THE HELP BUT NONE OF THE SOLUTIONS YOULL SUGGESTED WORKED. CAN ANYONE ELSE HELP ME?
andrew11
22
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 1st Mar 2004 03:20
You need to post some of your source code. We cant fully understand the question and problem without it.

"All programmers are playwrites and all computers are lousy actors" -Anon
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 1st Mar 2004 05:19
Heres some code to get a visual

mypitch#=((weight#*carheight#*acc#)/(w_base#*9.8))/(weight#*carheight#)

if weightfront#<>0 and weightrear#<>0
if weightfront#<weightrear#
carPitchangle#=-1.0*acos(weightfront#/weightrear#)*carheight#
else
if weightrear#<weightfront#
carPitchangle#=acos(weightrear#/weightfront#)*carheight#
else
if abs(weightfront#)=abs(weightrear#)
carPitchangle#=0.0

endif
endif
endif

endif

if steer_radius#<>0
carRollangle#=((weight#*carheight#*vx#^2)/(steer_radius#*9.8))/weight#*carheight#
else
carRollangle#=0.0
endif

set object rotation zyx 1

pitch object down 1,wrapvalue(carPitchangle#)

turn object right 1,wrapvalue(carangle#)

roll object right 1,wrapvalue(carRollangle#)
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Mar 2004 09:06
We either need some working code, ( ie, code we can copy + paste into DBC, hit F5 and have it run ) so that we can see what's happening, or we nee a screen shot ( or two ) showing the problem, along with the section of code that controls the rotation ( any rotation )

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 2nd Mar 2004 21:23 Edited at: 2nd Mar 2004 21:26
How can i paste a image to this site.
Youre asking me to show lots of code that im busting my ass to get working right.
Listen All you have to do is load a object into darkbasic and rotate it on all three axis and check to see if it wabbles. Thats all you have to do. If this is not enough.
Then ill post my code to show whats going on.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 3rd Mar 2004 00:53
So, you mean if I were to use this snippet, it'd have that effect?



If so, I don't see the "wabling" effect anywhere in there, it just rotates it around all the angles...

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
zane
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: manchester, england
Posted: 3rd Mar 2004 11:40
make sure any values that control x/y/z positions are real vaules, not intergers (ie - value#, not just value). this was causeing a wobbeling problem with me recently

www.zaneproductions.tk - lots of games, no Dark basic ones though (yet)!
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 3rd Mar 2004 21:53 Edited at: 3rd Mar 2004 21:54
Jessticular try using bigger values and picture the object as a car
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 3rd Mar 2004 21:55 Edited at: 12th Mar 2004 11:06
******
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 3rd Mar 2004 23:40
Ya know, there is the possibility that it has nothing to do with your code. Is your car model's geometry centered on 0,0,0 (aka the origin)? Objects rotate around their origin point. If your model is not centered, it will wobble when rotated.
--
TAZ

zane
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: manchester, england
Posted: 4th Mar 2004 00:01
wouldent that just cause the poivot to be in a diffrent position. i dont see how it would make it wobble

www.zaneproductions.tk - lots of games, no Dark basic ones though (yet)!
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 4th Mar 2004 00:42
Well, I don't know if the wobble is visible due to complete rotations or if it wobbles while running down the road. Just offering some advice. From the initial post, the implication is that the whole model is off center.
--
TAZ

Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 4th Mar 2004 07:54 Edited at: 4th Mar 2004 07:56
The model was modeled on its center and it only wables when the object yrotates and zrotates at the same time.
Anyway thanks for all the possible solutions that you'll have given me, im just tired of this thing right now. I feel like quitting.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Mar 2004 11:34
Ah... One thing I have picked up on is that the first angle of the three ( by default it's X [ ie, X,Y,Z ] ) Is a world angle, whereas the others are local angles...

It's just a quirk of the engine...

Can I ask why you have set the rotation to zyx?

If you are rotating only around the z and y axis, just leave the rotation as xyz and don't worry about the x angle.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 9th Mar 2004 07:27
I tried to change the order of rotation hoping that it would solve the problem but it didnt. Any way thanks for all the help.

Login to post a reply

Server time is: 2025-05-23 08:16:53
Your offset time is: 2025-05-23 08:16:53