0

I've this CharacterBody2D subtype:

using Godot;
using System;
using Recoyx.CarKnockOnline;

public partial class AutomobileEntity : CharacterBody2D
{
    public PlayerData PlayerData = null;

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
    }

    // Called every frame. 'delta' is the elapsed time since the previous frame.
    public override void _Process(double delta)
    {
    }
}

I'm playing around with it by calling MoveAndCollide on the _Process subroutine of my game screen:

// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
    this.MainPlayerEntity.MoveAndCollide(new Vector2(2f, 2f));
}

... where this.MainPlayerEntity is an instance of the AutomobileEntity type above. The motion works, but it has unexpected constant jumps (laggy GIF recorder, so you'll see only few):

Constant jumps

The CharacterBody2D in question has motionMode = grounded. I tried motionMode = floating as well. I've also tried tweaking the velocity property of the CharacterBody2D and using this same method for moving the entity.

Why does the CharacterBody2D keep jumping?

MoveAndSlide

I did also try MoveAndSlide and it keeps constantly jumping with velocity (212, 212).

Hydroper
  • 344
  • 2
  • 9

0 Answers0