Hi, im trying to create a simple scene with two rigid bodies, one will be a table that can rotate in space the other just a ball:
is there a proper way of doing this? I've tried using _integrate_forces(state) but the scene behavior is buggy, the table keeps jumping around, the code I'm using to rotate the table is as follows:
extends RigidBody
var rotation_dir = Vector3(0,0,0)
var RotSpeed = 0.01
func get_input():
rotation_dir = Vector3(0,0,0)
if Input.is_action_pressed("ui_up"):
rotation_dir.x = -1
if Input.is_action_pressed("ui_down"):
rotation_dir.x = 1
if Input.is_action_pressed("ui_right"):
rotation_dir.z = -1
if Input.is_action_pressed("ui_left"):
rotation_dir.z = 1
func _process(delta):
get_input()
func _integrate_forces(state):
var Tform = state.get_transform()
Tform.origin.x = 0
Tform.origin.y = 0
state.set_transform(Tform.rotated(rotation_dir,RotSpeed))