 Thread: creating object C where A and B meet

1. creating object C where A and B meet

Is it possible to create an active object at the point--or average of coordinates--where two other objects meet? I'm guessing you can't, but I figured I'd ask anyway.  Reply With Quote

2. Re: creating object C where A and B meet

Would this work for what you are doing?:

*Compare two general values> X(activeA) = X(avtiveB)
+Compare two general values> Y(activeA) = Y(activeB)
+Special> Run this event once

Create object activeC relative to (0,0) of active A

Hope this helped!  Reply With Quote

3. Re: creating object C where A and B meet

I don't think so, because I'm not trying to create the object at (0,0) relative to active object A. I'm trying to create it where the two objects meet. The problem with that is, if the objects overlap at more than one point, you'd have to find a way to create the third object at the center or average of the coordinates. That's why I don't think this is possible.  Reply With Quote

4. Re: creating object C where A and B meet

When the two object collide you need to do a mathematical calculation using fastloops.

Here is the basic logic for two boxes colliding and maybe overlapping.

Collision event,

Get x,y of 1
get width and height of 1

do the same for the second object.

Now you need to find the area of the collision or overlap in terms of x,y and width and height. Since you have two areas you subtract from each other.

Then you are left with a box. To find the centre of the box you need to use a bit of trig. but an easier way is to work out the co-ordinates of each corner and find the halfway point. then add the horizontal and vertical halfway point to the value. You are now presented with an x y value which is the centre of the collision box.

For other shapes there are a number of algorithms you could use depending on what the situation and requirement where.

Hope that is of some help.  Reply With Quote Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•