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 AppGameKit Corner / How can I make an object spin?

Author
Message
Kot
7
Years of Service
User Offline
Joined: 2nd Mar 2017
Location:
Posted: 29th Mar 2018 23:18
I'd like to have a dice that I could roll. The problem is that it falls down as a static object and bounces when it hits a plane under. I added a second plane that the dice rolls from, but I'd like just to throw it spinning along chosen axis. Is there a command that I can use or using the sloping plane is the only way?
The second problem is that after rolling it trembles for some seconds and sometimes even changes the result. How can I make it stand still after rolling?
puzzler2018
User Banned
Posted: 29th Mar 2018 23:29 Edited at: 29th Mar 2018 23:31
Take a look at

RotateObjectLocalX (object, angletorotatex)
RotateObjectLocalY (object, angletorotatey)
RotateObjectLocalZ (object, angletorotatez)

Use of different numbers on angletorotatex, angletorotatey, angletorotatez

Will give the desired effect

could you post what you have so far so we can see where the trembles coming from
Kot
7
Years of Service
User Offline
Joined: 2nd Mar 2017
Location:
Posted: 30th Mar 2018 16:02
So I have to rotate my dice until GetObject3DPhysicsFirstContact returns True and then stop rotating? I thought there is a magic word that says "Spin!" but I just couldn't find it
My code is the simplest you can think of:

Sometimes the dice stabilizes almost at once, but among dozens (or more than a hundred?) of rolls I did there were one or two when the dice jumped and changed the result.

Attachments

Login to view attachments
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 30th Mar 2018 21:47
try this one:
SetObject3DPhysicsAngularVelocity
Kot
7
Years of Service
User Offline
Joined: 2nd Mar 2017
Location:
Posted: 2nd Apr 2018 23:09
Thanks, now it works better. Too bad that there is not much explanation on it in help pages :/
If I want to reroll, do I have to set up again all the physics? Because if I move the dice up with SetObjectPosition, it doesn't fall down again :/
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 3rd Apr 2018 11:20
Kot wrote: "Too bad that there is not much explanation on it in help pages :/"


True! You'll have to get The Official AppGameKit Tutorial Guide Vol 2, which cost money, but is pretty good!
puzzler2018
User Banned
Posted: 5th Apr 2018 14:49
This book looks super impressive and just the ticket for beginners - from the example pics from it, it looks like what we need for 3D programmers too

With 900 + Pages too, brings me back to the AMOS Professional hard copy book

This will be your AppGameKit Bible...



Kot
7
Years of Service
User Offline
Joined: 2nd Mar 2017
Location:
Posted: 5th Apr 2018 15:28
Yeah, I've got it since it became available, but the closer to the end of the book, the less information it gives, not much more than "this is a command, these are the parameters, do what you want with it". Let's look at SetObject3DPhysicsAngularVelocity( objID, angX, angY, angZ, initialSpeed ). I don't know what are the parameters angX, angY, angZ. Are they 0/1, or all the intermediate values between 0 and 1? Or can they be e.g. 73? What is the initialSpeed parameter? I had to do some experiments to learn that it's angular speed in degrees per second, because at first I thought it's angle change per one frame. And so on. And IMO all that information should be available just in help file in the editor.
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 5th Apr 2018 18:10
Oh, so it's "angular speed in degrees per second"

So THAT'S what the documentation meant when it said "the Z component of the angle vector"

Login to post a reply

Server time is: 2024-04-23 21:53:00
Your offset time is: 2024-04-23 21:53:00