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.

Newcomers DBPro Corner / x/y/zrotate object question/bug

Author
Message
haXor
23
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 7th Aug 2003 06:22
Ok well for my off-road motorcycle game i want it so when i go up hills, the bike rotates acourdingly to the slope angle so it is riding bothin wheels on the ground instead of plowing right through it (hehe i love these new smiles) but anyways, the line of code i am using is this : [b]if groundh#>posy# then xrotate object 1,(groundh#-posy#) (btw, im not sure of the ending formula, but it should be about right) now what happens is i hit the first hill and it adjusts to it then wont change anymore, because even in the loop, the rotate object command goes once then wont repet itself again. i tested it many ways, like the line if upkey()=1 then move object 1,1 repets over and over, but if upkey()=1 then xrotate object 1,10 wont work. any ideas? i cant think of a better way to fix it. thanks for the help
~haxor
Sup Kids
Morales
23
Years of Service
User Offline
Joined: 9th Feb 2003
Location: - Please Select -
Posted: 7th Aug 2003 08:08
ill give you some code that might do it so stand by for a while.
haXor
23
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 7th Aug 2003 17:01
standing

Sup Kids
Morales
23
Years of Service
User Offline
Joined: 9th Feb 2003
Location: - Please Select -
Posted: 7th Aug 2003 21:55
sory something hapend to my cpu. i might have a way to get what you wont i was thinking i could do it but its harder than i thought.
ill see what i can do
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 7th Aug 2003 23:21
for sure it works but you don t see any changes because your command simply sets the xrotation angle to the value of groundh#-posy# (or 10 in the second example).
putting your command in other words what you are doing is:
if inkey$()=1 the set x angle to 10
to get an incremental thing you must code like this:
xangle#=object angle x(object)
if in key$()=1 then xangle#=wrapvalue(xangle#+1)

for the groundh# thing it would be:

xangle#=wrapvalue(xangle#+(groundh#-posy#))

(wrapvalue is used to make your angle stay in the 0-360 degrees range)

hope its clear..
cheers

P.S. > if groundh#>posy# then xrotate object 1,(groundh#-posy#) <
this is wrong since it will only react when groundh# is bigger than posy#, which may not be the case all the time
haXor
23
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 8th Aug 2003 03:03
ooo wow thank you. i never realized that the xrotate object and such just set it, i thought it increased it. And i do have code to do it for downhill, i just didnt put it in. thanks to all for the help.
~haxor

Sup Kids

Login to post a reply

Server time is: 2026-07-07 07:35:10
Your offset time is: 2026-07-07 07:35:10