propertykeron.blogg.se

Godot kinematicbody2d
Godot kinematicbody2d










Added a script to the RigidBody2d (Ball.tscn) and did: extends RigidBody2D

godot kinematicbody2d

Player as KinematicBody2d, using the demo from the link above. But I kept looking on this node properties and saw the "rotation degrees". I searched about that yesterday before posting and I found this nice tutorial and demo: īut sadly your hint didn't work with "angular_velocity". I have not tried it myself, but I think that would cancel out any rotational velocity the box could have, which should make it no longer rotate. You might be able to work around this though by adding something like the following to your RigidBody node: func _physics_process(_delta): Hmm, it seems there is no option to lock rotation of a RigidBody2D like there is for RigidBod圓D nodes. If not force and not can_play_sound: return If global.is_box(body) or global.is_player(body):įor body in $Area2D_right.get_overlapping_bodies():įor body in $Area2D_top.get_overlapping_bodies():įor body in $Area2D_bottom.get_overlapping_bodies():Įlif box_sm.is_on(box_sm.states.floating): Linear_vel.x = lerp(linear_vel.x, direction * WALK_SPEED, desaccel)įor body in $Area2D_left.get_overlapping_bodies(): Linear_vel = move_and_slide(linear_vel, FLOOR_NORMAL, SLOPE_SLIDE_STOP) If linear_vel.x > 0 and linear_vel.x body.linear_vel.x: return If ayer_sm.is_on(ayer_sm.states.push) and direction = 0 and previous_direction != 0: If global.is_player(body) and box_sm.is_on(box_sm.states.idle): Here's my GDS for the box: extends KinematicBody2Dįor surface in :

godot kinematicbody2d

The Player is basically the one from the Kinematic 2d platformer demo.

godot kinematicbody2d

I need the boxes to be aligned to the ground. I tried to use RigidBody2d boxes, but it spins when touched. When include at least one box over another and try to push them all, sometimes it just don't move until I move that top box a little bit.

#GODOT KINEMATICBODY2D CODE#

I'm building a simple "push the boxes" system, but something in my code isn't working as expected.










Godot kinematicbody2d