question

Maryam H2 avatar image
0 Likes"
Maryam H2 asked Maryam H2 commented

Companion Visualization

Hi there,

When using this code below:

patient.Companions.clone().push(patient)

to let companions walk with patients, how we can avoid the visual problem so companions and patients are not standing on top of each other.

1649364658699.png

thanks

FlexSim 22.1.0
visualwalkstand
1649364658699.png (16.8 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ryan Clark avatar image Ryan Clark commented ·

Hi @Maryam H2, was Ryan Clark's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Ryan Clark avatar image
0 Likes"
Ryan Clark answered Maryam H2 commented

Hi @Maryam H2,

You can set the location of the Companion using Companion.location (FlexScript Class - Object (flexsim.com)). You can set the location vector to be equal to the current location plus some offset, and that should place the companion next to the patient instead of the same location as the patient.

I hope this helps! Let us know if you have further questions!

· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Maryam H2 avatar image Maryam H2 commented ·
Hi @Ryan Clark

Thanks for the answer! Using this approach, could I apply it to all companions that the model creating in real time. In the model, all patients have at least one companion.



0 Likes 0 ·
Ryan Clark avatar image Ryan Clark Maryam H2 commented ·
Hi @Maryam H2,

Yes, you should be able to apply this in real-time. Wherever you're running the code to create the Companions, you can just have a line of code immediately after that that sets their location.

0 Likes 0 ·
Maryam H2 avatar image Maryam H2 Ryan Clark commented ·

@Ryan Clark

I'm creating companions as shown below, do you mean using a custom code should I set a location? I tried it and it doesn't work.

1649712392528.jpeg


0 Likes 0 ·
1649712392528.jpeg (288.6 KiB)
Show more comments