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 / [SOLVED] 3dphysics

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Mar 2019 14:13
Trying to do a golf game,3D, using the physics within the engine I coded, the problem is, I have to set the cansleep() to 0 so the ball remains active, this causes another problem,as when i read out the velocity of the ball at anytime it seems to never be zero,so i am guessing if you set sleep to 0 then a random +- value gets fed to the x,y,z velocities, very small values!
But how do i tell with that, that the player can shoot again, ideally i wanna check if the x,y,z velocities are zero, but they never are!
Hail to the king, baby!

The author of this post has marked a post as an answer.

Go to answer

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Mar 2019 14:22
if you can follow the code KrazyGrandPrix cars use physics to move and keep the cars moving
https://forum.thegamecreators.com/thread/223651 it achieves the constant movement
with the command SetObject3DPhysicsLinearVelocity being constantly set
fubar
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Mar 2019 22:19 Edited at: 10th Mar 2019 22:23
have you played with SetObject3DPhysicsSleepingThreshold() ?

otw, you can do it manually by checking the distance moved per frame (or time), as you've indicated doing. just don't (ever) expect zero. ie, if distance# < threshold#, put it to sleep.

add: 3d (physics) golf is on my to-do list, as well. i'm curious about how much control you're taking vs using default values for things like mass, volume, friction, damping, restitution, etc?

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 11th Mar 2019 03:29
ah, i'm having (not-so-fond) memories re: setting/checking those thresholds. i remembered that sometimes the distance will = 0.0 when it's actually still moving... i thought it came up in blink's kart thread along with a work-around but couldn't find it on a quick skim. alas, since we dont have a GetObject3dPhysicsIsSleeping() command, we'll have to work one out for ourselves.

meanwhile, started a proof of concept:


which includes something like:


good luck, shadey. share when ur ready

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 11th Mar 2019 07:13
looks great Virtual Nomad
fubar
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 15th Mar 2019 21:35 Edited at: 16th Mar 2019 14:35
This post has been marked by the post author as the answer.
I personally just used a bit of math to solve it!




I really hate math beyond addition coz I be a dumbass..lol
But this was a must and works out perfect!
*** Edit *** Added comments to help explain!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 16th Mar 2019 00:50 Edited at: 16th Mar 2019 04:34
Ok, share you say?!


having lag issues with this god aweful pc tablet though!!

P.S.. Excuse the heavy breathing on the video,in fact mute it! ,I have a bad chest infection!

This is just one game mode of many the 3D engine I coded can run,it also has a first person mode, platformer, tilt to roll a sphere and adventure mode!
Coded this in a way that I can even swap game modes at anytime during level run, so 1 second you are that golf ball, then for some really wack reason,you turn into a guy holding a gun in first person mode, or a mario type guy jumping onto a platform.... it all lends to some interesting game design ideas!!
Errr, but for now I will just keep it golf,and take my meds...


here is adjusted ball size/gravity/speed and added shadows..

Hail to the king, baby!

Login to post a reply

Server time is: 2024-11-23 02:51:11
Your offset time is: 2024-11-23 02:51:11