How to create imitation of the flexible stick.

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

How to create imitation of the flexible stick.

Post by Magnet »

How to create imitation of the flexible stick.
I must influence upon one edge and stick must be bent..
Image
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

Well, bending equation for a beam is:

d=PL^3/(3EI)

Where d is the displacement (in millimeters), P is the force (in Newtons), L is the length to the point of bending (ie, in your image, you would calculate this at four points), E is the modulus of elasticity of the material (steel = 210,000 MPa), and I is the moment of inertia.

To calculate the moment of inertia, you need the cross-section of the stick. Lets say it's round, then we use:

I=pi*r^4/4

Where r is the radius of the cross-section.

Cheers,

Pinky
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

Post by CodeDog »

That is assuming that the force applied is always perpendicular to the tip of the stick. If the vector of the force is constant ( like for example gravity on a stick hanging out sideways) then as the stick deforms, the angle of the force applied to the tip of the stick will change. You may or may not want to correct for this depending on how accurate you want your simulation to be.
With a force that is aways perpendicular to the tip and given enough force applied, the stick will form a spiral. This is not the case if the vector of the force remains constant.
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

My method is only valid for small displacements anyway. It is just a suggestion of a method - you need to try it, and see if it is good enough for what you need.
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I do not know how to begin.
That it is necessary to use?
I must use the bones to bend my model?
I never with this did not face.
Please help me.
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

Post by CodeDog »

Start with:
http://irrlicht.sourceforge.net/tut004.html
This will show you how to move nodes.

sgt_pinky gave you the math you need.
It's up to you to write the C++ that uses the math.
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

You not understood me.
I do not know how to start realisation this problem.
I have a model of the fishing rod. How to bend it?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

if you want to use bones, you can set bone positions using acki's x custom bones patch.
but for such a simple mesh as a stick it would be just as easy to move the vertices of your mesh manually.
use smgr->getMeshManipulator()->createMeshCopy(IAnimatedMesh->getMesh(0)) to get an SMesh from your model file, then you can access the SMeshBuffer and deform it by setting the positions of the vertices.
start your journey into the docs at the mesh manipulator and finish somewhere around SMeshBuffer. (you'll need to cast SMesh->getMeshBuffer to an SMeshBuffer)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Thnx.
As I afterwards can force to move the bones on curve?
Post Reply