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 / Converting an angle to a 3D vector

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Dec 2017 21:14 Edited at: 14th Dec 2017 21:15
I am trying to adjust the gravity setting for the 3Dphysics.
How can i generate a x/y/z vector from an angle. I want to generate a vector from a 10 degree rotation around the x axis. like so



Looking at that i'm thinking it should be -10 degrees. Anyway i would like a general algorithm because i think i'll need to use it a fair bit

Thanks in advance for any help/advice

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 14th Dec 2017 22:13
Should be something like this:
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Dec 2017 22:15
Thanks janbo. I'll give it a go
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Dec 2017 23:36
As is the code doesn't work for me. Plugging it into the Set3DPhysicsGravity() function.
This gives me something that i'm looking for. Which is an x values of zero, a Y value approaching -1 and a small positive Z value .1 - .2 roughly


What am i doing wrong here?
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 15th Dec 2017 00:40
I'm toying with a mobile labyrinth thing. Would be cool to rotate the gravity with GetRawAccelX(), GetRawAccelY() & GetRawAccelZ()!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 15th Dec 2017 02:11
Quote: "I'm toying with a mobile labyrinth thing. Would be cool to rotate the gravity with GetRawAccelX(), GetRawAccelY() & GetRawAccelZ()!"

Here is an example someone else posted when 3D physics was added.
The coffee is lovely dark and deep,and I have code to write before I sleep.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Dec 2017 05:41 Edited at: 15th Dec 2017 05:44
Tile Maze
Nice to get something working. Although i did practically nothing

Attachments

Login to view attachments
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 17th Dec 2017 15:07
Question:

How come in the original example one can also make it work on a PC using cursor keys, while in the 2nd piece of code it no longer works like that, only my android phone?

Login to post a reply

Server time is: 2024-11-24 05:45:26
Your offset time is: 2024-11-24 05:45:26