# Particle Question: how to attach...

• 01-21-2006, 08:45 AM
Snipergen
Particle Question: how to attach...
Hi, if somebody could solve my problem, I finally can start creating levels for my game. Almost everything is done, only the ragdollphysics. The ragdolls itself are done, but I need to attach limb pictures etc... to the ragdoll

There you can download flade and the most usefull thing for me is that you create two particles and attach a stupid drawing to it (for example a woodblock). So that the block follows the constraint between the particles, got it?

Here's an example of the ragdoll (simple) that I created with Flade : http://sniperware.50webs.com/ragdoll.swf

My question is pretty hard isn't it? I tried everything!
• 01-21-2006, 01:08 PM
ozmic66
Lets say, for example, the upper arm of your ragdoll extends from 'pointA' (shoulder) to 'pointB' (elbow)

to attach a movie clip to that, try doing the following thing:

(i'm assuming that the axis of the movieclip is where the arm is supposed to turn(shoulder))

1. position the movieclip at pointA.x,pointA.y

2. ang = getAngle(pointA,pointB) //in degrees

3. movieclip._rotation = ang //add or subtract from this value to correct for angle offset

im guessing you know how to find the angle between two points ;)
• 01-21-2006, 01:26 PM
Snipergen
No, i dont :(
thanks for the help.
• 01-21-2006, 01:52 PM
ozmic66
try this
Code:

```function getAngle(pA,pB){   var xDiff=pA.x-pB.x   var yDiff=pA.y-pB.y   var radians = Math.atan2(yDiff, xDiff);   if (yDiff<0) {     radians += (2*Math.PI);   }   radians-=Math.PI   degrees = radians*(180/Math.PI)   return degrees }```
good luck