Just to put this out here, idk if i should put this in scripting support
Hello everyone, i am trying to recreate a skate system like in the game “SKATED” but for another type of vehicle, anyway my question is, for any movement that makes the player spin or jump in the air, should i use roblox body movers (on the client of course) or should i rely more on math, since from what i know roblox physics can get pretty messy and lets be honest most games dont aim for perfect physical realism.
Anyway, if physics are more reliable, can anyone suggest body movers for making a thing smoothly jump in the air and fall back down without any “Glitchyness”(or rotate for that matter) I cant recommend enough to check out the game i listed above since i really like how they handle their physics but i just dont know if they use body movers or just math.
I mean honestly now that i think about it no one will try to simulate gravity using math when its already in the roblox studio physics engine, its just stupid(sorry if anyone tried), but again the movement in that game feels too good to be done entierly by roblox’s physics engine(of course there’s always math involved, but you get it)
My current approach is just using a renderstepped loop and teleporting a skateboard(example) model to an invisible vehicle(that uses hinges) and i apply all the math to that “illusion”. So far so good, but when it comes to coding tricks and spins, its a lot of pain since i gotta decide either to rotate the illusion model using math OR rotate the vehicle that uses roblox’s physics.
Had to put this (^^^) out there just so you get some kind of idea on what im trying to do.
So yeah, my main question is should i use body movers and are they too wonky / janky or should i rely on math, and PLEASE recommend a way to make a thing(lets say a skateboard) jump in the air smoothly.
Thanks for reading this text bomb. Any help is really appreciated!!
1 Like
Doesn’t hurt to try Physics Constraints in my opinion. It will 100% save you the headache of having to do custom physics. I’ve made some custom CharacterControllers that utilize Physics Constraints and haven’t ran into that many issues. Also make sure you’re using the new Physics Constraints and NOT the legacy Body Movers. In the past the new constraints we’re pretty inconsistent and performed poorly however, recently they’ve become REALLY good. It takes a bit more time to setup but, once you get the hang of them you’ll 100% prefer them over the old ones.
For your question about how to make some sort of jump, I have done this in my most recent CharacterController and it accurately jumps up to my JumpHeight specified. The most math you’ll need while working w/ Physics is mostly to figure out how much Velocity needs to be applied to reach x height and or position, etc.
Here’s the method from the Jumping state in my StateMachine which does the above if you’re curious:
function Jumping:OnEnter(characterComponent)
local jumpHeight, hipHeight = characterComponent.Instance:GetAttribute("JumpHeight"), characterComponent.Instance:GetAttribute("HipHeight")
local initialVelocity = math.sqrt(2*workspace.Gravity*(jumpHeight+hipHeight))
local velocity = Vector3.yAxis*initialVelocity
local rootVelocity = characterComponent.RootPart.AssemblyLinearVelocity*Vector3.new(1,0,1)
characterComponent.RootPart.AssemblyLinearVelocity = rootVelocity + velocity
end
Hope this helps! Honestly, just keep experimenting until you find something that feels right for your use case.
1 Like
Yeah sure as u said doesn’t hurt to try, just a few minutes ago i tried using vector force and it seemed to work decently on the client, but i have a question, should i use vector force(a new body mover) OR Change the assemblyLinearVelocity, which one will give smoother results. I mean as i said math is ALWAYS needed, cuz i plan to do all the movements of the “fake” board(such as tilts, spins, etc) using cframes and lerps, since as i said earlier “Physical realism” is sometimes too realistic.
1 Like
Either or should work… there’s also ApplyImpulse for BaseParts… I think for simulating pushing a VectorForce would be the way to go… you’d pretty much simulate the push for x seconds, stop the force, and then do it again basically… you’re just controlling when the pushing takes place. I recommend starting small before jumping into crazy tricks and what not. If you don’t have good board movement it might not be worth it to jump straight into tricks. I do this all the time when making systems LOL.
1 Like
yeah i mean i would say my movement system is pretty good at doing its job i havent seen any difficulties when riding the vehicle , well thanks a lot for the advice IG roblox physics is the way to go! Thanks a lot for replying and have a niiice day
For anyone reading this the topic is still opened for more recommendations and tips if anyone has to share
1 Like
If you’re looking for something to spin your objects for tricks (and/or maintain rotation), you could use AlignOrientation. It would align your object to PrimaryAxis and SecondaryAxis (if you have OneAttachment enabled)
- PrimaryAxis deals with the X axis –
Vector3.new(1, 0, 0)
on default
- SecondaryAxis deals with the Y axis –
Vector3.new(0, 1, 0)
on default
Both of the axes are based on the AlignOrientation’s CFrame property – to rotate your object, modify the rotation of it’s CFrame.