Hi, does anyone know how and what to use SetLinearVelocity for?
SetLinearVelocity but in fort_character, not in objects (I know it’s in beta, but I was trying to use it and didn’t understand it. I thought that when I set it and ran, it would go faster, but that didn’t happen. It didn’t give me a boost or anything like that, so I don’t know how to use it).
I just experimented with that function and found that it behaves more like an impulse. For example, it will set the linear velocity, but immediately gravity + damping will begin to slow the object down.
So for a constant boost, you’d probably need to be constantly setting it. Something like:
OnBegin<override>()<suspends> : void =
SpawnedAgent := PlayerSpawner.SpawnedEvent.Await()
if:
# Getting the Fort Character of the spawned player.
PlayerCharacter := SpawnedAgent.GetFortCharacter[]
then:
loop:
PlayerCharacter.SetLinearVelocity(vector3{Left:=0.0, Up:=100.0, Forward:=0.0})
Sleep(0.0)
Yes, I saw that it was something related to impulse, but when I applied it, it simply didn’t even push me. Later I will try your code and continue experimenting with it. Thank you very much for answering, your thing will help me a lot, thank you again.
Oh and sorry, but I had a question about the loops, I saw that you put “sleep(0.0)” that doesn’t generate that when you want to publish your map you get an error for infinite loop or something? I always had that doubt and that’s why I kept my loops at 0.1 or similar
I tried with Sleep(0.1), you can feel that things are happening slower. (1/10th of a second is 100 Milliseconds, not sure at what Hz the physics simulation is running at, but if it’s processing at 30fps it would be evaluating every 33 Milliseconds)
I’m not sure if Sleep(0.0) is a publishing block, I do vaguely recall some loop errors in the Technical → Verse Errors section of an island on the Publishing portal. Overall that ‘Sleep’ is just in there to “make the red squigglies go away”. I’m interested in learning the best practices around loops + trying to do things on simulation tick.