Jump to content

Rope with physics


Genebris
 Share

Recommended Posts

You need to set a mass as well as a shape.

But when I delete shape of the barrel (set it to none), it still falls down like a normal prop. but it doesn't collide with anything.

Ok, how can I set a shape to bone? I didn't manage to do this with "Fit shape" button or with .phy file.

Link to comment
Share on other sites

What Barrel?

 

Personally I wouldn't do it this way, because the bones are all part of the same model. If a bone moves, it might affect its children as well, causing glitchy physics.

I would start of with creating a pivot in the scene which is the rope anchor. The pivot has no mass or phy shape

Then place a cylinder underneath it. the cylinder has a shape and a mass. Then via a script create a ball joint between the pivot and the cylinder.

  • Upvote 1
Link to comment
Share on other sites

If make a few cylinders and connect them with joints there will always be a small gaps between those cylinders while rope is moving.

Here is physics tab of the barrel:

http://i.imgur.com/awoIvkh.png

And here is bone:

http://i.imgur.com/SRpfdax.png

When I launch the game barrel falls down through the terrain and bone with the part of the rope mesh simply disappears.

Link to comment
Share on other sites

Barrel is just an example of normally working prop without any collision shape. I can't understand why bone doesn't work like the barrel.

I can't set any shape to the bone. When I press Fit shape on the rope mesh it works and orange parallelepiped appears, when I load a .phy file for this mesh it works as well and orange box appears too. But when I fit shape or load the same shape file for the bone, nothing happens. I can't apply shape to bones from another model I previously created as well.

It seems like bones can't have shapes.

Maybe I can use simple meshes instead of bones? Can I attach rope's skin to other meshes instead of bones?

Link to comment
Share on other sites

So I need to take bottom polygon of the first cylinder and move it to the position of the pivot between first and second cylinder? Then I need to set rotation of this polygon to pivot rotation and then I need to do the same with top polygon of the second cylinder?

Haha, smart!

I'll try this, thank you guys for helping.

Link to comment
Share on other sites

Just try my example, each cylinder has a pivot object as child, it uses it to position the joint ball to the parent object.

I'm trying right now to make follow the rotation of joints to a rope model with bones, i will post results if things come up good.

Stop toying and make games

Link to comment
Share on other sites

I made some example, i make bones top rotate as same as cylinders.

The probelm is rotation applied on bones is weird, perhaps some GetRotation or SetRotation issue.

At start the bones are ligned horizontally while cylinder are vertically aligned with no rotation ?

 

I put the updated project for anybody to test.

export jpint.zip

post-3271-0-28220600-1407537375.jpg

  • Upvote 1

Stop toying and make games

Link to comment
Share on other sites

It's not a Blender problem.

(Just need an animated material to have it animated in LE3 otherwise it won't animate even rotating bones)

 

I used GetOmega and SetOmega to set speed rotation on Y to 0 as we don't care about it for a vertical rope, this helps a lot in stability. In the script i also changed Z rotation values by adding -90° so the rop is vertical, now i got the rope working good, i just need to tweak some rotation axe and it will be ok.

Don't worry, i'll post that on tutorials section.

post-3271-0-90462800-1407539164.jpg

Stop toying and make games

Link to comment
Share on other sites

I used wrong button, download is ready now.

(feel free to delete the function postRender on rope.lua script as it was debug code)

 

Cylinders for physics are not so good , the really best would be to use capsule shapes collisions instead , it would avoid collision problems near center of the joints between two capsules.

Stop toying and make games

Link to comment
Share on other sites

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.

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.

 Share

×
×
  • Create New...