Collisions in 3D World Editor with Matlab and without Simulink

2 views (last 30 days)
Hi, I have a robotic arm which moves thanks to the connection of the model in 3D World Editor and a GUIDE interface developed. Now I want to introduce an object and when the object is touched, this could be moved. I started incorporating a LinePick Sensor in which I included the object in which the sensor is incorporated and the object to be touched. In order to check that this works, I wrote the following code but the sensor does not seem to work:
CODE
global world
col=vrnode(world,'Sensor_1_1');
color=vrnode(world,'PieceColor');
if col.enabled=='True'
color.diffuseColor = [1 0 0];
color.emissiveColor = [1 0 0];
color.specularColor = [1 0 0];
end
Any ideas?
Thank you very much in advance.
Blanca

Answers (1)

Muhammet Dabak
Muhammet Dabak on 11 Nov 2020
enabled is determines that sensor is being used or not.
You should use .isActive property to check sensor flag is on or not.
if col.isActive == 1
But be aware that this LinePickSensor can detect objects with their geometry.
For further questions, please ask.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!