I’m currently developing a movement system, It works fine for the most part, but inconsistently It seems to break (stop moving) and produce a Failed to call message response callback function, has it been deleted?
error,
through testing I have found out that the message callback does go through as normal, but the actual movement velocity tends to get stuck between two values, this is a modified port of my player movement script, that uses action.value, which I modified to work with a single vector for direction,
any help
local target_speed = self.Velocity.x * MaxSpeed --MaxSpeed is 0
local speed_diff = target_speed - self.Velocity.x
local acceleration = vmath.vector3(0, Gravity, 0)
if speed_diff ~= 0 then
if speed_diff < 10 then
acceleration.x = -MoveAccel
else
acceleration.x = MoveAccel
end
end
local dv = acceleration * dt
if math.abs(dv.x) > math.abs(speed_diff) then
dv.x = speed_diff
end
local v0 = self.Velocity
self.Velocity = self.Velocity + dv
local dp = (v0 + self.Velocity) * dt * 0.5
go.set_position(go.get_position() + dp)
self.Correction = vmath.vector3()
Sorry, I’m not really following the logic here. In update(), all you do is send a velocity consisting of self.x (what is that?) and a hardcoded -650 and apply this to self.Velocity. Somewhere else (where? when?) you process the velocity to change the position. When doing that you change self.Velocity - but I don’t see how this would persist since you overwrite it with your message every frame.
I feel like you need to walk us through step by step and explain what you are doing.
my enemy structure is based on a subclass and superclass system, all enemies have the superclass script, (Template), as well as their own unique features in another script
it starts by the unique script checking individual conditions, to output self.x and self.y (self.y is not needed for this enemy so I used the default gravity of -650), this is then passed to superclass script
self.Velocity is then fed into the collision code (not shown here due to lack of relevance) and the position update code (shown in my first post) which processes that velocity. This code is messy as I got it of the defold website for player movement, which I adjusted to remove it needing an input, I wish I had better understanding of the code but I’m not sure how much help I can give for it
This looks like something has been deleted before it should have been.
The movement velocity error is/could just be a side effect of this and not the problem.
I suggest looking at your message passing logic and application lifecycle.
I suggest that you zip up the entire project (excluding the build folder) and share it here. It’s a guessing game at the moment when we can’t see the full source.