My model is always returning the position of the bottom left corner of the floor storage rather than the slot.
My model is always returning the position of the bottom left corner of the floor storage rather than the slot.
Vec3 globalLoc1 = token.slot.as(Storage.Slot).storageObject.location;
This is the same as writing
Object Rack = token.slot.as(Storage.Slot).storageObject; Vec3 globalLoc1 = Rack.location;
and returns the location of the storage object the slot is in. To get the position of the slot use the "getLocation()" method on the slot itself. Note that this will return the coordinates in the reference frame of the storage object, so you have to project from there to the model to get the global coordinates.
(You can write it all in one line, but because the slot reference is needed twice this would be rather lengthy, so I opted to create a "slot" variable.)
Storage.Slot slot = token.slot; Vec3 globalLoc1 = slot.getLocation(0.5, 0.5, 0.5).project(slot.storageObject, model());
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved