It looks like you're new here. If you want to get involved, click one of these buttons!
Hi guys, I'm trying to get the speed of a moving object using orxObject_GetSpeed. It works on my player who has had the speed set with orxObject_SetSpeed.
But now I'm trying to get the speed of a moving platform, which is moved using FX as setup in the ini file. It looks like GetSpeed is always returning a zero vector on this object. Is it possible to get the current speed of such an object that is moved by a speed effect? Probably I've done something wrong but can't find it yet.
Here is the effect on the object in question:
[HorzElevatorFX]
SlotList =HorzElevatorSpeedSlot
KeepInCache = true
Loop = true
[HorzElevatorSpeedSlot]
Type = Speed
Curve = sine
StartTime = 0
EndTime = 11
Absolute = true
StartValue = (100,0,0)
EndValue = (-100, 0, 0)
Comments
Hi @funemaker,
I wasn't able to reproduce your issue. I tested by
init
ializing a new project and replacing the[Object]
section with:The speed was correctly displayed under the white square. Are you setting a speed value on your object from another source than your FX by any chance? Does your object have a body? If so, is it a dynamic or kinematic one?
Thanks. Yes, it has a body with dynamic set to false. I'm not setting the speed anywhere else.
I'll see if I can make a simple test project that reproduces it. If not, something else must be going wrong in my code somewhere.
Hmm, I can't reproduce it in a simple project, so I'll keep looking at my code to see what is going wrong. I'm getting a reference to the elevator object in a collision event (these are platforms that the player can land on)...possibly I'm somehow getting a reference to the wrong object.
Yes, found it! It was my mistake....orx is working exactly as expected! Really enjoying using orx.
As always don't hesitate if you have any questions.