Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DriNeo | |
Old Version | Published before Godot 3 was released. |
Hi. You can try this example script on two Kinematic bodies.
extends KinematicBody2D
export var Velocity = Vector2()
func _ready():
set_fixed_process(true)
pass
func _fixed_process(delta):
if is_colliding():
if get_collider() extends KinematicBody2D:
set_opacity(0.5)
move(Velocity.normalized() * 20 * delta)
Set the velocity of a single body in order to hit the other. You will notice the non moving body doesn’t change his opacity. Even if “move” function is called everytime.
I can keep my code simple if each kinematic body is able to detect collisions by himself, even if the velocity is null.