Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mrmtonio |
I want this kinematicbody (left) to push this rigidbody (right) and make it roll.
To make it roll i presume I’d have to use add_force() or apply_impulse(). But I can’t figure out how to detect collision. The best I could come up with is this:
enter code hereextends RigidBody2D
func _ready():
pass
func _process(delta):
if $KinematicBody2D.get_position() == position:
add_force(Vector2(0,0),$KinematicBody2D.direction*300*delta)
But that’s really shitty code, hope it gets the point across.
(I’ve also been trying it other ways with get_slide_count() or get_slide collision(), but the $KinematicBody2D on the code returns null, although it is on the same scene, I’m trying to figure that out too.)