e_boulanger Posted July 12, 2015 Share Posted July 12, 2015 I am developping a small Foosball game. I set the ball object physics to Rigid Body, Prop, and with a mass of 5. The foosmen on a rod are attached to a pivot which controls their rotation. Each foosman physics is set to Rigid Body, Scene, Nav Obstacle = true. When the ball is moving, it can react to the foosmen rotating. If the ball is stopped, the foosmen pass through the ball. I suspect the way I set the physics is responsable for this. Does someone have a suggestion on how to set physics setting correctly so the foosmen can hit the ball when they are rotating. Thanks. E. Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 13, 2015 Share Posted July 13, 2015 Try setting both to swept collision. Also load the foosball player into the Model Editor and pick a physics shape from the menu. See here for more details: http://www.leadwerks.com/werkspace/page/tutorials/_/models-and-animation-r8#section6 Note do not use Polymesh for either. And unless you are going to build a navmesh, there is no reason to have the setting 'Nav Obstacle' as true. This probably has no effect either way if no navmesh, but just pointing out that option is meant for navigation. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Slastraf Posted July 13, 2015 Share Posted July 13, 2015 also always try to use box shapes or sphere shapes (or convex hull) but I would not recommend a poly mesh physics shape. They are very glitchy in my games, usually they dont have gravity enabled (when I use them) Quote Link to comment Share on other sites More sharing options...
holschuh Posted July 13, 2015 Share Posted July 13, 2015 in Editor "View"- "Show Phyics" to check your collision shapes. Quote Link to comment Share on other sites More sharing options...
e_boulanger Posted July 15, 2015 Author Share Posted July 15, 2015 Thanks everybody for replying. My first problem is my model itself. In the editor, I chose "Polymesh". Like MrShawkly said, they are problematic. I also read that the "Polymesh" react as if it has a mass of 0. Which is not good. So first thing I did, I change the "Polymesh" to the "ConvexHull". Second, when I was rotating the foosmen, I rotated the object itself. Unfortunately, rotating an object by itself does not affect the physics of the game. So I had to change the waythe rotation was done. This was more complicated than I though. Before, everything was controlled through a pivot, to which all the foosmen on the same rod were attached to. Now I have to individually assign a script to each foosmen, even if they are on the same rod. (I wish I could assign the script to the pivot, but it does not work) That script creates a joint.Hinge for each object. And in the UpdatePhysics function I had to use a script like this: -- if X has changed if currentMousePos.x ~= self.lastMousePos.x then -- calculate difference local diff = currentMousePos.x - self.lastMousePos.x -- calculate new rotation self.angle = self.angle + diff -- set the angle and speed so that movement is quick self.joint:SetMotorSpeed(diff * 60) self.joint:SetAngle(self.angle) self.joint:EnableMotor() else self.joint:DisableMotor() end Sometimes the rotation angle is wrong (I have to work on this), but now when a foosmen turn, it can come in contact with the ball. Now I have to figure out a way to move the foosmen laterally as well. I am presently trying with a slider. But it gives me a bit of problem and I do not know if I can combine both the slider and hinge on the same object. 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.