smashthewindow Posted October 20, 2011 Share Posted October 20, 2011 Hi, I'm trying to code something like the Bouncy Ball in GMod. (Here's a video: )Basically, I'm trying to create a mesh that bounces without losing any velocity at collisions. I've tried this by setting the velocity constantly at update callback functions(the one that gets called every frame, UpdateEntityCallback), but I've realized that sometimes the ball goes through the walls. Any suggestions for a better implementation? Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
Canardia Posted October 20, 2011 Share Posted October 20, 2011 SetBodyElasticity(ball,5); Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
smashthewindow Posted October 21, 2011 Author Share Posted October 21, 2011 SetBodyElasticity(ball,5); I thought max value was 1? P.S: it still goes through walls when it gets fast enough. Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
paramecij Posted October 21, 2011 Share Posted October 21, 2011 To prevent fast moving objects from missing collisions, use: void SweptCollision(TBody body, int mode=1) But too fast moving objects can still fall through, so you might want to clamp the velocity in the update callback Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.