[solved] Get upward orientation of object and add scale value

Hey community, so i have been trying to tackle this problem which is basicly a how to question. i am trying to move an object to the edge of another object, i almost got it to work except for a ‘minor’ orientation problem, this is the code snippet:

currenthelditem.transform.localPosition.y = Vector3.up + snaptarget.parent.transform.localScale.y * 2;

of course the above doesn’t work but it shows my intentions :slight_smile: so basicly my question is how do i use the up orientation of the ‘snaptarget’ transform and add the localscale value to it. any ideas ?

I have no idea what the code is trying to do but here is my best guess.

You want to position currenthelditem two units local above snaptargets parent.

var item = currenthelditem.transform;
var parent = snaptarget.parent.transform;
item.position = parent.TransformPoint(Vector3.up * 2);

Send a comment if this is not what you meant and please clarify.