whiterabbit Posted August 20, 2014 Share Posted August 20, 2014 I have a model of a sphere with a collision mesh imported into Leadwerks and I wanted to control how 'bouncy' it was. Did a google search and came across the functions SetElasticity and SetSoftness (seems like they were called SetBodyElasticity and SetBodySoftness in older versions). The current docs don't mention these functions, or at least not on Entity, and when I try to call them they obviously don't exist. Does anyone know if they've been renamed, not available to Lua, removed for some reason? Just a few things I found: http://www.leadwerks.com/werkspace/topic/2546-balls/ (This has a Lua script that calls SetElasticity which makes me think it did exist at some point) http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/bodies/setbodyelasticity-r58 (Old docs) http://www.leadwerks.com/werkspace/topic/4683-problem-with-collision-callback/ (C++ but calls SetElasticity) Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 20, 2014 Share Posted August 20, 2014 It seems that those are older functions from LE 2. At the moment I do not believe such functions exist (at least for lua). I had a similar issue so I made a little script for my ball to make it bounce. It looked like this - function Script:Collision(entity, position, normal, speed) self.entity:AddForce(0,.25*speed,0) -- Add Global force to make the ball bounce upwards. self.entity:AddForce(0,.25*speed,0,false) -- Add Local force to make the ball have a random bounce end Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
whiterabbit Posted August 20, 2014 Author Share Posted August 20, 2014 It seems that those are older functions from LE 2. At the moment I do not believe such functions exist (at least for lua). I had a similar issue so I made a little script for my ball to make it bounce. It looked like this - function Script:Collision(entity, position, normal, speed) self.entity:AddForce(0,.25*speed,0) -- Add Global force to make the ball bounce upwards. self.entity:AddForce(0,.25*speed,0,false) -- Add Local force to make the ball have a random bounce end Thanks, I thought that might be the case. I just didn't want to have to do it myself. Quote Link to comment Share on other sites More sharing options...
whiterabbit Posted August 20, 2014 Author Share Posted August 20, 2014 Although doing it manually doesn't give the ability to have less than normal bounce. EDIT: Sorry for double post. I'm used to posts auto-merging together on another forum. Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 20, 2014 Share Posted August 20, 2014 You could also mess with giving the ball a higher mass, adding more or less force in that script, or even changing your worlds gravity amount. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
whiterabbit Posted August 20, 2014 Author Share Posted August 20, 2014 Yep, I'm already going to be doing those things in different situations so it's not really a simple option. Gravity is disabled on the world and the ball applies a force to itself to simulate gravity so I can change the direction of gravity (not sure if you can change the gravity direction for the entire world?). I'll try and work around it for now. 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.