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 / Sparky's - Demo Movement Speed

Author
Message
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 8th Jan 2015 20:59 Edited at: 8th Jan 2015 21:03
Hey all, I've implemented Sparky's collision demo in my own code and adapting it to suit my needs. Things are going okay and I understand most of it.

However, I'm not able to raise the movement speed of my character controller... currently the character is walking way too slow.

Here's the code:


Any help is much appreciated! Thanks!

Regards Sph!nx
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 9th Jan 2015 00:11
Quote: "f player is jumping or falling then apply 'normal' gravity // if not attempt to keep the player stuck to the floor if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity# if keystate(32)=1 : vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#) : endif if keystate(30)=1 : vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#) : endif if keystate(31)=1 : vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#) : endif if keystate(17)=1 : vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#) : endif"


Add a distance value to the sin/cos calcs, this works to control speed

Vx# = vx# + sin(angy#) * speed#

Ideally you want to multiply this further by a time delta for timer based movement to keep it steady regardless of framerate

Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 9th Jan 2015 00:20
Thanks Ortu!! Sometimes I miss the obvious stuff. I feel a bit stupid now...

I've got a fully working timer based loop, so I guess the sync stuff is no issue in regards to speed.

Thanks again!

Regards Sph!nx

Login to post a reply

Server time is: 2026-07-06 19:48:05
Your offset time is: 2026-07-06 19:48:05