Page MenuHomeFeedback Tracker

attachTo no longer working with setDir
Feedback, NormalPublic

Description

In Arma2 CO and early versions of Arma3, you could set the direction of an attached object relative to the parent object. This no longer works.

Also, attachTo is acting very screwy. If I attach and object to another object, then detach the object, I can't seem to be able to reattach it again.

Also, attaching an object to another moving object has very strange effects where the attached object seems to be lagging behind the moving object badly. This happens at low or high fps.

Details

Legacy ID
462070275
Severity
Minor
Resolution
Reopened
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. Create two objects via createVehicle.
  2. Attach second object to first object via the command:

secondObject attachTo [firstObject,[0,0,0]]; secondObject setDir 90;

The second object will not rotate 90 degrees off the axis of the first object. Also, if the first object is moving, the second object will lag behind the first object after attaching.

  1. Detach the second object from the first object via the command:

detach secondObject;

  1. Try to reattach the second object again via the command:

secondObject attachTo [firstObject,[0,0,0]];

Sometimes it works, sometimes it doesn't. When done quickly from an sqf script, often it doesn't work.

Additional Information

UPDATE:

You have to execute attachTo and setDir/setVectorDirAndUp twice in a row to work around the issue:

http://feedback.arma3.com/view.php?id=7228#c59723

Event Timeline

Feint edited Steps To Reproduce. (Show Details)Apr 15 2013, 2:12 AM
Feint edited Additional Information. (Show Details)
Feint set Category to Scripting.
Feint set Reproducibility to Always.
Feint set Severity to Minor.
Feint set Resolution to Reopened.
Feint set Legacy ID to 462070275.May 7 2016, 1:37 PM
Feint added a subscriber: Feint.May 7 2016, 1:37 PM
Feint added a comment.Apr 15 2013, 2:32 AM

If attachTo has been modified with new functionality, please update the Biki so that we can figure it out. I have several mods and addons on hold now waiting for this to be fixed.

Squelch added a subscriber: Squelch.May 7 2016, 1:37 PM

I have created a feature request related to this asking for attached objects to follow rotations when attached to model selections #0008488

I can confirm that the setDir works.

Create a player unit, and a Camping Chair. Name it Chair.

player attachTo [chair,[0,-0.15,-0.5]];
player setDir 180;
player switchMove "InBaseMoves_SittingRifle2";

use setDir after the unit has been attached to it.

Also setting the direction of the unit while it is attached to an object will set the direction the unit is facing relatively to the chair, not the world space.

So if a chair is facing east in the world space, attaching the unit to chair using [0,0,0] will set the unit NORTH relative to the chair but EAST relative to the world space, in which case setDir 180 will making the unit face SOUTH relative to the chair, but WEST in the world space.

Just thought i'd try and explain if people start to wonder why it is not working the way it is, when in fact actually is, it's just they are using the commands wrong.

I assume we can close this one if it works as expected? Maybe BIKI needs updating too?

Noddan added a subscriber: Noddan.May 7 2016, 1:37 PM
Noddan added a comment.Nov 7 2013, 3:53 PM

This issue is still not resolved.

Apparently: "attachTo is broken. You can setDir an object that is attached to a unit, but not another object."

http://forums.bistudio.com/showthread.php?167311-Cant-setdir-to-attached-Object

@Noddan your setVectorDirAndUp code doesnt make sense, this is why it doesn't do anything. To rotate notepad 90 degrees follow BIKI example 1 https://community.bistudio.com/wiki/setVectorDirAndUp

Noddan added a subscriber: KillZone.May 7 2016, 1:37 PM
Noddan added a comment.Nov 7 2013, 7:01 PM

@KillZone Kid: Ofc I've tried that one as well... Just had another go, changed the code to:

notepad attachto [desk1,[0,0,0.4]];
notepad setVectorDirAndUp [[1,0,0],[0,0,1]];

Still no difference.

I've figured this out. For some reason the script has to be performed twice (Are you reading devs?)

notepad attachto [desk1,[0,0,0.4]];
notepad setVectorDirAndUp [[1,0,0],[0,0,1]];

^^^ FAILS. In fact it fails 100% whatever you do.

for "_i" from 1 to 2 do {
notepad attachto [desk1,[0,0,0.4]];
notepad setVectorDirAndUp [[1,0,0],[0,0,1]];
};

^^^ WORKS

EDIT setdir instead of setvectordirandup works too, if you execute script twice

Noddan added a comment.Nov 7 2013, 7:32 PM

Yes!! Finally! ;)

notepad attachto [desk1,[0,0,0.4]];
notepad setdir 90;
notepad attachto [desk1,[0,0,0.4]];
notepad setdir 90;

works as well as you said.

It's a bug don't get too excited!

Feint added a comment.Nov 25 2013, 6:44 PM

Ugh. I just discovered this fix on my own. SO frustrating.

F2kSel added a subscriber: F2kSel.May 7 2016, 1:37 PM

The objects are not attached no matter how may times you run the script, if you move the original object the so called attached objects are left behind if they're small items.

It does fix the direction but that's all.
You also don't need the second notepad setdir 90, just notepad attached [desk1] will do.

But as mentioned they're still not attached.

Actually no need for double execution any more to set dir, I think it has been fixed

Setting to resolved. Make sure to double-confirm.

For me it do not work on Dedi in SP it is ok.

Agreed. Not working on dedicated servers but does work in SP or hosted MP.
I wonder if this is down to setdir being a local command with some object classes?

R34P3R added a comment.Apr 4 2015, 3:07 PM

Still not working on Dedi.

F2kSel added a comment.Apr 4 2015, 3:58 PM

I think attachto has been virtually abandoned as a command you only have to look at the issues surrounding it, it's a pity as it was one of my favourite commands.

Just ran into this on dedi. Works great if client hosted. Will this receive any attention from devs?