View Full Version : Overlapping problem
Darth Arias
December 20th, 2006, 06:05 PM
OK, I have this:
http://img262.imageshack.us/my.php?image=020628ws7.swf
I want it so the legs do not overlap. Here is part of the code for the legs:
var dx = this._x-body_mc._x;
var dy = this._y-body_mc._y;
var angle = Math.atan2(dy, dx);
var targetX = body_mc._x+Math.cos(angle)*radius;
var targetY = body_mc._y+Math.sin(angle)*radius;
How might I achieve this? Any advice is appreciated.
Dazzer
December 20th, 2006, 11:38 PM
define Overlap. There can only be 1 object per Z-layer, so I'm guessing that's not what you mean.
you mean a hit detection for the legs that prevents them from going cross legged?
absolutely awesome stuff there though.
Darth Arias
December 21st, 2006, 12:46 AM
Yeah, basically, sorry, I am bad at the wording thing.:blush:
Dazzer
December 21st, 2006, 10:02 AM
instead of hit detection, why don't you try calculating distance between two "points" which are the centre of the circles
SacrificialLamb
December 21st, 2006, 07:07 PM
Can’t you use a similar thing to what you have on the center circles and the legs if you do it sneakily you could almost get away with only testing the 2 legs on ether side of the testing leg
Darth Arias
December 22nd, 2006, 01:16 AM
True... Well, so far, it actually rips the space time continuem when applied...
What I mean is, I have to change the formula to accomodate the smaller distance, because they are trying to
1) stay 50 pixels from the main ball, and
2) stay 50 pixels from each other.
Obviously, they cannot do both. They end up bending reality. Here is a screenshot of what it looked like after a minute or so:
http://img511.imageshack.us/img511/8061/picture1ab6.png
Freaky... I ned to either shorten the required distance from each other to the radius of the balls, or lessen the physics incredibly... I will try the first.
Dazzer
December 22nd, 2006, 01:40 AM
that's a ... **** load of legs. lol
good luck
Darth Arias
December 22nd, 2006, 01:46 AM
In reality, there was only 10 legs on the creature. Try to imagine what it looked like while happening... my eyes were wide...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.