#How do I add inertia to my movement.
1 messages · Page 1 of 1 (latest)
hm
so like
remove the friction basically?
just kinda like slide at a certain speed?
Yes, and if the character moves to a different place, the enemy has a bit of trouble turning
ah i see!
you will basically just be turning down the friction a whole lot
slippery enemy 🙂↕️🙂↕️🙂↕️
I'm doing it top down though
so in the code you’ll remove the acceleration for the enemy and lower the friction
old LOZ
okay
so it’s basically an rpg
or in the style of one
uhh
it should be simple
as long as the enemy can move in all four directions using a navigation mesh 2d and has low friction (and some in between) to make a slippery dude you should be good!
extends CharacterBody2D
var target: CharacterBody2D
var direction: Vector2
const FORCE = 3.0
const MAX_SPEED = 200.0
func _physics_process(delta: float) -> void:
look_at(target.position)
direction = (target.position - self.position).normalized()
velocity = direction * MAX_SPEED
move_and_slide()
I haven't used force because I haven't figured out how to do this
lol i gotcha
So?
hang on i’m tryna write some code for ya
Thanks
True
well i can’t necessarily test code here so it wouldn’t be any help. hmm
i’ll try to find you a good in depth tutorial
I tried
either that or you could try changing your characterbody2d to a rigidbody2d and slow the friction down in the rigid body node inspector
tbh i’ve never made an rpg in godot lmao
just kinda throwing stuff at the wall hoping it sticks to help you rn😅
I see