Frictional Games Forum (read-only)
Attaching entities - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Attaching entities (/thread-14771.html)



Attaching entities - DRedshot - 04-14-2012

I'd like to attach two entities together, so they behave as one entity. I cannot use a sticky area, because the entities will be moving up and down a rope

I have tried AddAttachedPropToProp, but due to it's nature it looks horrible. The attached prop falls through the floor, and it makes the whole thing look messy.

Is there another way to do this without making the second entity lose it's physics properties?

Thanks!

Edit: Solved! I just attached the entities by modifying the bodies so they interlocked Big Grin
For now it works fine, and doesn't seem as buggy as I first thought. Tested a good 10-20 times, and still no bodies have glitched through each other so i'd say it works Smile



RE: Attaching entities - Putmalk - 04-14-2012

Are we talking about attaching like a bucket to a rope? Then yes, you have to use AddAttachedPropToProp, like I do here:



at around 2:10.



RE: Attaching entities - DRedshot - 04-14-2012

Ugh, I was really hoping I could have done it another way. It doesn't look so bad on yours, because buckets are light, and it's in mid-air when you attach it too.
The problem is, the thing I am attaching is a heavy weight (like in the control room-cistern map) It looks so unnatural when it swings along with the other entity.
I'll explain in a bit more detail below. (slight Spoilers!)
Spoiler below!

I have a rope, at the end of the rope is a hook. This hook is attached to a heavy weight, and the hook with heavy weight is used as a counterweight/pulley mechanism.

The hook is attached to the rope as a end body, so it has physics. However, when I want to attach the weight to the hook, it loses physics properties, clips through the floor, and loses all of it's mass...

The scripting all works, it's just not very good to look at :/

Thanks for the reply anyways Smile



RE: Attaching entities - Putmalk - 04-14-2012

The rope area should have an EndBody of an invisible_box_mass, then attach the prop to the invisible box. It should use the box's physics, not the prop's. It will be as light as the bucket.



RE: Attaching entities - DRedshot - 04-14-2012

Ahhh, I see what you mean.
The invisible box's size would have to be adjusted each time an object is added though, otherwise either
A - Clipping would occur when the weight is added.
B - There would be an invisible mass surrounding some distance from the hook before the weight is added.

Also, the invisible box behaves strangely :/
It spins freely in all directions when it's on the end of the rope.



RE: Attaching entities - Putmalk - 04-14-2012

Are you sure you didn't set it up right? My invisible box does not behave strangely at all, it follows Newton's laws: it's stationary when I don't touch it. Smile

And I don't know if it's possible to resize objects via script...you might be able to attach different items to it or just ignore the clipping.



RE: Attaching entities - DRedshot - 04-14-2012

(04-14-2012, 04:14 AM)Putmalk Wrote: Are you sure you didn't set it up right? My invisible box does not behave strangely at all, it follows Newton's laws: it's stationary when I don't touch it. Smile

And I don't know if it's possible to resize objects via script...you might be able to attach different items to it or just ignore the clipping.
It's fine if I don't touch it, or leave it alone for a good 30 seconds, but interacting with the box makes it slowly revolve for ages, often making the attached props invert (which looks a bit wierd Tongue). Unfortunately, interacting with the rope is an important part of the puzzle.
It might be possible to work-around the clipping, or maybe keep the weight as an entity until it is pushed down the rope. I'll decide on which one i'll do later, I'm going to have a break for a while, thanks for helping.