Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
2

Does a PhysicsStepped event exist? [closed]

Asked by
Dfzoz 345 Moderation Voter
2 days ago

I was creating a golf game some time ago but I stopped working on it because I couldn't create a wind factor that is precise. I would like to know if there is an event that fires along with every physics update so I can maybe add it.

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
1
Answered by
SteamG0D 1489 Moderation Voter
2 days ago

Fifkee is wrong, you never want to do any physics related updates with RenderStepped, that should be reserved for camera manipulation only! Even in the link he provided, it shows that the physics simulations happen after the render occurs. If you do decide to use RenderStepped for everything, your game will have low fps even on high end computers. So what you should do instead is use the Heartbeat:

game:GetService("RunService").Heartbeat:Connect(function()

end)
Ad
Log in to vote
1
Answered by
Fifkee 2016 Administrator Moderation Voter Community Moderator
2 days ago
Edited 2 days ago

Physics updates occur every frame. Knowing this, you can utilize the RenderStepped signal like so:

game:GetService("RunService").RenderStepped:Connect(function()

end);

You can see what happens in a frame in this image provided by the Roblox Developer Forum: https://devforum.roblox.com/t/how-does-runservice-work/619565/2