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.

AppGameKit Classic Chat / using GetDirectionX() and GetDirectionY() to control a 3D physics enabled ball

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 24th Feb 2018 17:01
Does anybody have some code for rolling around a 3D ball using GetDirectionX() and GetDirectionY() and setobject3dphysicslinearvelocity()
tried a few things but doesnt look right and not sure what to set the initial speed value in setobject3dphysicslinearvelocity()


Also I have noticed if I set the velocity speed to 0 and the objects physics is set to never sleep, the object seems to vanish, so I can never set it to stop dead
Hail to the king, baby!
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 25th Feb 2018 15:43
For your last question, you probably don't want to set the physics object to never sleep, as that prevents it from ever stopping dead as you mention. Haven't tried the first thing you ask yet, so I am not sure.
What exactly doesn't look right? Or rather, how do you calculate the velocity added to the ball? There might be something in your code that prevents a smooth result somehow.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 25th Feb 2018 18:07
The problem is if I do not set it to never sleep,i find that it stops dead after a few seconds and I am unable to apply any more linear velocity for some reason
Hail to the king, baby!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th May 2018 17:28
not sure about adding physics velocity but if you print the values of GetDirectionX() you will notice they need to be multiplied
like I have in this part of my driving game

full source available here https://forum.thegamecreators.com/thread/222027

hope that helps apologies if it was something you had known
fubar

Login to post a reply

Server time is: 2024-04-20 09:43:47
Your offset time is: 2024-04-20 09:43:47