Floor Spot_on Enter location

Floor Spot_on Enter location

mhosseini457NG
Advocate Advocate
2 Views
2 Replies
Message 1 of 3

Floor Spot_on Enter location

mhosseini457NG
Advocate
Advocate

[ FlexSim 24.0.2 ]

Hi - How I can make the operator to walk to the center of floor spot and face toward the workbench?

model_op_walks_to_centeral_loc.fsm

0 Likes
Accepted solutions (1)
3 Views
2 Replies
Replies (2)
Message 2 of 3

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

Here's a user command and example model where you can call faceObject and it will figure out the rotation and apply it to the te (or any object you supply as the first parameter). Also attached is a library to autoinstall the command to any model.

The user command code is:

/**Custom Code*/
Object te=param(1);
Object involved=param(2);
Variant p3=param(3);
Vec3 midbaseFactors=Vec3(0.5,0.5,0);
Vec3 factors=midbaseFactors;
Vec3 unitx=Vec3(1,0,0);
if (p3.type==VAR_TYPE_ARRAY)
    factors=p3;
Vec3 targetloc=involved.getLocation(factors).project(involved.up,te.up);
Vec3 tepos=te.getLocation(midbaseFactors);
targetloc.z=0;
tepos.z=0;
Vec3 heading=targetloc-tepos;
double angle=heading.angle(unitx);
te.rotation.z=angle;
return angle;

faceObject.fsmfaceObject.fsl

Attached is your updated model.

model-op-walks-to-centeral-loc_jl.fsmfaceObject.fsm

0 Likes
Message 3 of 3

mhosseini457NG
Advocate
Advocate
got it, very useful. thanks!
0 Likes