Powerhorst Posted February 21, 2015 Share Posted February 21, 2015 Hey guys, So I'm currently trying out Leadwerks during my free-time and must say, I'm really happy with it. As my first Learning-project I want to create a simple BrickOut-Clone (Maybe better known as "that Pong-game where you try to destroy blocks") Now most of this works out fine for me and I'm starting to understand the engine-concepts but I can't seem to get the ball-behaviour right. Usually in those games the ball hits a barrier or the player-paddle and reflects its direction without losing any of its velocity. If it choose to make the ball a rigidbody the reflections will happen without any problems (thanks to the colliders) but it will naturally lose its velocity thanks to the impact. Do you know any ways to prevent this from happening? It seems like I'm only lacking a simple command line to get this done. Something like rigidbody.KeepForce or rigidbody.SetElasticity Thanks in advance for any help Greets Quote Link to comment Share on other sites More sharing options...
awgsknite Posted February 21, 2015 Share Posted February 21, 2015 you could addforce when the ball hits : http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityaddforce-r156 or setomega: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetomega-r823 or something that is here that starts with the word Entity in this list : http://www.leadwerks.com/werkspace/page/documentation/_/index/ Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
YouGroove Posted February 21, 2015 Share Posted February 21, 2015 You can set the velocity to the value just before the impact happened. The problem is velocity will stay constant. I don't know if there is a way to tell the objects to behave like normal after we set the velocity ? I mean you set the velocity that stays constant , than calling a function the object would loose velocity behaving like normal physics ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
awgsknite Posted February 21, 2015 Share Posted February 21, 2015 You can set the velocity to the value just before the impact happened.The problem is velocity will stay constant. and then maybe set it back on after impact or gravity off ? Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
YouGroove Posted February 21, 2015 Share Posted February 21, 2015 Yes perhaps "gravity off" before the impact ' raycast detection from center of the object, than some time after the impact set gravity "on". This could work. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Powerhorst Posted February 21, 2015 Author Share Posted February 21, 2015 Thanks a bunch, guys I'll try that later. 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.