0 votes

I really need someone to hold my hand with this one
and treat me like a beginner. The online instructions and
youtube videos aren't working.

So I have a kinetic body 3d, it's basically just the
floor of my game. I want to simply add either the
accelerometer or gyroscope ( not sure what one to use )
to the floor so when I tilt my phone the floor will tilt in the
same direction.

My current code:

var rotationn = Vector3(0,0,0)

const SPEED = 6

func _process(delta):

var rotationn = Input.get_gyroscope()

move_and_slide(vector3(rotationn.y, 0, rotationn.x) *

SPEED, Vector3.ZERO)


The platform will move back and forth depending on the
direction my phone is tilted in but it doesn't tilt, it just moves
in the direction I am tilting and slides across the screen, I want the floor to actually tilt
and I want the floor to remain stationary, I want it to stay
where it is but tilt in the direction my phone is tilting in.

Thanks, I hope I was clear enough. My code is probably completely
wrong, it was just the closest I could get for it to perform the task
I wanted it to do.

Godot version 3.2
in Engine by (14 points)

1 Answer

0 votes

First I think instead of kinematic body, you should use a rigid body. You won't need to write lot of code if you do it right. Second you will need to look for formula to apply that velocity for the tilt to the rotation of the floor

by (189 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.