Jump to content
Alex88

roll the ball ... unfortunately not as long as I want ;)

Recommended Posts

Hello together, I'm still working on my "roll the ball" game and it's going forward, smile.png 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. huh.png

 

post-7920-0-50959000-1390321144_thumb.jpg

 

post-7920-0-30794200-1390321149_thumb.jpg

 

 

I don't use any script for my ball, just the following physic settings:

 

post-7920-0-56415000-1390321154.jpg

 

 

Any ideas? smile.png

Link to post

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?

Link to post

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 ?

Link to post

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

Link to post

@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 sad.png (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

Link to post

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 sad.png (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. unsure.png I will try your code tomorrow.

Link to post

@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.

Link to post

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.

Link to post

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. huh.png

Link to post

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.

Link to post

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.

post-1-0-47938100-1390508274.jpg

 

About that solution, can work for simple shapes, but won't work for example with a complex 3D castel model you can explore.

2.jpgeb264f2f-229b-4d6b-b672-1ba7f9074313Large.jpg

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)

Link to post

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.

Link to post

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?

Link to post

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. blink.png

 

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. huh.png

Link to post

Perhaps the object's mass is zero? I suggest uploading your map so we can try it out, along with any files it uses.

Link to post

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 ?

Link to post

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.
Link to post

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 ?

collision_ledge1__02.jpg

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...