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 / coding problems

Author
Message
codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 2nd Feb 2005 21:10
i am working on a tutorial and for some strange reason my gravity makes my cube go staright to the roof , after a while it comes back down and lands on my matrix then works normally ?

i have included the full source

Thanks for any and all help.
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 2nd Feb 2005 21:50
Don`t use the source button. It`s buggy and i can`t see your code.

You should go for the snippet instead like this:



Regards

The Nerd


looking for Royalty free 3D objects?
then Check PanzerGames at this link : http://www.freewebs.com/panzergames
codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 2nd Feb 2005 21:57
ok thanks

codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 3rd Feb 2005 05:10
i know its somthing simple i just cant seem to find what i have done wrong
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 3rd Feb 2005 06:08 Edited at: 3rd Feb 2005 06:10
I've never used matedit, or whatever it is, so I remmed out that code and replaced it with a normal matrix - and as you can see, it appears to work fine:



Perhaps, then, it's something to do with your loaded matrix.


codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 3rd Feb 2005 19:32
ric your matrix is flat and evreything does work, but if you add bumps into the matrix you'll experience a similar problem.
codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 3rd Feb 2005 22:47
You can try it out by using your code and randomizing the matrix
_Ashley_
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 4th Feb 2005 02:10
i have a similar problem myself

any help would be great for me to
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 4th Feb 2005 09:32
The fact that it runs fine after the first freakish jump seems to indicate that its something that will only happen the first time, due to certain values of variables, now I have a feeling that it could be round this area "ySpeed#(id)= ySpeed#(id) + (yPos#-get ground height(1,xPos#,zPos#))"

ok i think ive got it, when the game first runs your player is at y position 1, when your code realises its below the ground, it applies the upward speed to match it, thus catapulting it into the sky,
it doesnt happen with a flat matrix as the player would be on the ground then.
So my solution would be this


hope that works, if not ill have another go !
seeya
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th Feb 2005 10:14
Make everything inside your main loop but your sync command wait 2000 ms before running. That should fix it. It takes a while for the calcs to average as the FPS are through the roof for that short time. You can probably even lower it to 1000 ms or lower. I use 2000. You need to let the sync command and the loop timer run while it is waiting. Let everything else pause until then.

codeX
19
Years of Service
User Offline
Joined: 24th Jan 2005
Location:
Posted: 4th Feb 2005 19:40
Thanks Guys !

both your ideas worked

Login to post a reply

Server time is: 2024-11-27 20:45:58
Your offset time is: 2024-11-27 20:45:58