Alex88 Posted January 21, 2014 Share Posted January 21, 2014 Hello together, I'm still working on my "roll the ball" game and it's going forward, but now I have a problem with my ball. As long as the ball is rolling, everything works fine, but when the ball is reaching a corner or the playgound is absolutly straight, the collision detection and the physic calculation are going off. I don't use any script for my ball, just the following physic settings: Any ideas? Quote Link to comment Share on other sites More sharing options...
beo6 Posted January 21, 2014 Share Posted January 21, 2014 Hello, That looks nice already. Have you tried to enable the "Swept collision" option for your ball? If that does not help i suppose the physic is paused when the ball is at rest to save CPU cycles. Do you use PhysicsSetRotation for the playground movement? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 21, 2014 Share Posted January 21, 2014 This is a ball game , physics should work as the ball don't move at incredible speed. LE3 has some problems with physics, this can be related to that bugs perhpas : http://www.leadwerks.com/werkspace/topic/8199-collision-problems-on-imported-fbx-mesh/ Or another : http://www.leadwerks.com/werkspace/topic/7873-simple-collision-physics-not-working-on-model/ Could you post your models for us to test please ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Alex88 Posted January 21, 2014 Author Share Posted January 21, 2014 Have you tried to enable the "Swept collision" option for your ball? ... Do you use PhysicsSetRotation for the playground movement? I tried with "Swept collision" but the problem is still there. Here is my lua script: window = Window:GetCurrent() rotation = Vec3(0.0, 0.0, 0.0) rotationAngle = 8.0 pressAnyKey = false function Script:UpdateWorld() rotation = self.entity:GetRotation() --Time:Delay(1) if window:KeyDown(Key.W) and rotation.x < rotationAngle then pressAnyKey = true self.entity:Turn(1 * Time:GetSpeed(), 0, 0) elseif window:KeyDown(Key.S) and rotation.x > -rotationAngle then pressAnyKey = true self.entity:Turn(-1 * Time:GetSpeed(), 0, 0) else pressAnyKey = false end if window:KeyDown(Key.A) and rotation.z < rotationAngle then pressAnyKey = true self.entity:Turn(0, 0, 1 * Time:GetSpeed()) elseif window:KeyDown(Key.D) and rotation.z > -rotationAngle then pressAnyKey = true self.entity:Turn(0, 0, -1 * Time:GetSpeed()) else pressAnyKey = false end end I tried with PhysicsSetRotation but I don't get it to work. If I try it, my playground doesn't do anything. Could you post your models for us to test please ? Here it is. It is just a simple ball created in Blender without any uv mapping. The playground is made from primitives. Ball.zip Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 21, 2014 Share Posted January 21, 2014 why you dont use a sphere created in Leadwerks instead of the ball from blender? Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 21, 2014 Share Posted January 21, 2014 Right now you are using object translation rather they physics translation. Like suggested you either use SetRotation or use AddForce Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 21, 2014 Share Posted January 21, 2014 @DudeAwesome : Caus LE3 Sphere have bad UV mapping and you can't change it. I tried to make same game using BSP, even using Lua SetRotation, its was a pain and didn't succed to create such so easy game (LE3 will need some BSP physics and child physics revamp) I'll try a model to see if it works better. ---------- You can find the table level included. How ot test : - Create a new project -Download table level FBX and dezip it - Generate Physhape for FBX model and choose this physhape under physic tab - make a BSP ball above it - From editor place a camera to see table level and ball - create a new script with code below and attach it to the ball - run the game Here is the code for rotating the model table, but nothing happens ? Script.window = Window:GetCurrent() Script.rotation = Vec3() Script.rot = Vec3() function Script:Start() self.rotation = self.entity:GetRotation() self.rot = Vec3(0,0,0) --self.entity:SetGravityMode(false) end function Script:UpdatePhysics() local turnspeed=2 if (self.window:KeyDown(Key.Up)) then self.rot.x=self.rot.x+turnspeed*Time:GetSpeed() end if (self.window:KeyDown(Key.Down)) then self.rot.x=self.rot.x-turnspeed*Time:GetSpeed() end if (self.window:KeyDown(Key.Right)) then self.rot.y=self.rot.y+turnspeed*Time:GetSpeed() end if (self.window:KeyDown(Key.Left)) then self.rot.y=self.rot.y-turnspeed*Time:GetSpeed() end --self.entity:SetRotation(self.rot.x,self.rot.y,self.rot.z) self.entity:PhysicsSetRotation(self.rot.x,self.rot.y,self.rot.z,0.5) Time:Update() end Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Alex88 Posted January 22, 2014 Author Share Posted January 22, 2014 Right now you are using object translation rather they physics translation. Like suggested you either use SetRotation or use AddForce I tried to make same game using BSP, even using Lua SetRotation, its was a pain and didn't succed to create such so easy game (LE3 will need some BSP physics and child physics revamp) Here is the code for rotating the model table, but nothing happens ? Hmm okay, this sounds bad. I will try your code tomorrow. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 22, 2014 Share Posted January 22, 2014 @YouGroove you said create a new script with code below and attach it to the ball run the game Here is the code for rotating the model table, but nothing happens ? You said the new script that you are attaching to the ball is the code below, which you then say is for rotating the table. If you attach the script you have to the ball then you are rotating the ball not the table because self.entity in that script refers to the ball (because it's attached to it) and not the table. Attach that script to the table and not the ball and you should see the table move. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 22, 2014 Share Posted January 22, 2014 Thanks Rick. I typed too fastly , yes script attached to the table. I have the table rotating, but i'm stuck on sveral physics issues i'm struggling with. http://www.leadwerks.com/werkspace/topic/8342-le-31-steam-ball-physics-stoping-after-some-seconds/ That's sad, simple physics to be so hard to have them work, we will need a complete tutorial on monkey ball game style and physics settings. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Alex88 Posted January 23, 2014 Author Share Posted January 23, 2014 Here is the code for rotating the model table, but nothing happens ? Exactly, I tried your code but if I use the PhysicsSetRotation line, nothing happens. If I try the SetRotation line, it works, but there is still the bug with the ball. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 23, 2014 Share Posted January 23, 2014 Let's launch some new LE3 kickstarter campaign with "Bullet" or "Havoc" physics as first stretch goals Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Josh Posted January 23, 2014 Share Posted January 23, 2014 This question has been answered in the bug reports forum. It's working as intended, though a convex decomposition option would make the workflow easier. We actually had that in a beta, but it didn't make it into the final version. So it would not be hard to add. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
YouGroove Posted January 23, 2014 Share Posted January 23, 2014 About the closed bug related to same game style : ...this is because the physics shape is created from the model, and is using a polymesh collision shape, which has no volume and is is only good for static collisions So importing a complex model dungeon, would not have it's physics working with the generated shape. Caus any 3D model even the one i used has real volume indeed. Why generate polymesh would not create a volume if your model has voulume ? (Perhaps i don't knwo a lot about LE3 physic file generation i think) Even 3D tiles packs you buy that need complex collision caus they are not simple corridor cubes. About the workaround solution that is good : 1. Place your model at position 0,0,0 and rotate it to 0,0,0. Build a simple physics shape based on brushes around it.2. Parent those brushes to a single brush, doesn't matter which. 3. Right click and save the parent brush as a physics shape. You now have a physics shape that will react to physics, and not just do static collisions. About that solution, can work for simple shapes, but won't work for example with a complex 3D castel model you can explore. I can't imagine have to reproduce castel physics using BSP when other engines proposes perfect collision with 3D castel mesh even without having to generate any physic File. ----------------- Well let's say we have to do with work around for physics, and let's hope LE3 to grow in the future in that area, the best workflow would be like other 3D engines : - import your model - choose Modle Mesh as collision And that's it anything will collide with the castel even if you move it. I'm aware LE3 highter priority is really elsewhere so i won't insist on that point. (I keep my mni ball game test for the day LE3 will support model collision could it be static or not static) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Josh Posted January 23, 2014 Share Posted January 23, 2014 If your castle isn't rolling around on the ground, then using the polymesh collision shape isn't a problem. Polygonal shapes work fine for static geometry. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Trigger Posted January 24, 2014 Share Posted January 24, 2014 When you say other engines you mean Unity? because in UDK you have to create your collision shapes with primitives in a 3d modeling package and Cryengine use empty materials for collision detection, speaking of which what are the naming conventions for textures in Leadwerks? Quote Link to comment Share on other sites More sharing options...
Alex88 Posted January 24, 2014 Author Share Posted January 24, 2014 I have downloaded the example from the "bug report" and tried it, but I have still the problem, if I use the PhysicsSetRotation line, nothing happens. If I use the SetRotation line it works, but there is the ball bug. In the example you use an fbx floor and need to add a brush physics shape, but in my project I already use brushes for the playground. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24, 2014 Share Posted January 24, 2014 Perhaps the object's mass is zero? I suggest uploading your map so we can try it out, along with any files it uses. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alex88 Posted January 24, 2014 Author Share Posted January 24, 2014 Ahh ... this is the missing detail! Now it works. Thank you very much! Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 24, 2014 Share Posted January 24, 2014 How monkey ball games works with physics ? because level is not cubes and a complex shape and physics rotation works with the ball. http://www.youtube.com/watch?v=OrDYZXtBNWw It is a camera trick ? Level not rotating, and only ball rotating moving ,and camera following it ? And 3D background rotating to give the illusion it's level platform rottaion lol ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Josh Posted January 25, 2014 Share Posted January 25, 2014 How monkey ball games works with physics ? because level is not cubes and a complex shape and physics rotation works with the ball. http://www.youtube.com/watch?v=OrDYZXtBNWw It is a camera trick ? Level not rotating, and only ball rotating moving ,and camera following it ? And 3D background rotating to give the illusion it's level platform rottaion lol ? Brushes can be built to create all kinds of shapes. The necessity to have a shape with volume is a common theme in physics libraries. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
YouGroove Posted January 25, 2014 Share Posted January 25, 2014 Well these monkey ball games are in engines that don't use any BSP. The necessity to have a shape with volume is a common theme in physics libraries. BSP or model, both are geometry and volume and good for static collision. Cylinder and cubes , capsule etc ... are needed for moving geometry only or character collision right ? Quote Stop toying and make games 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.