Collisions in 3D World Editor with Matlab and without Simulink

1 次查看(过去 30 天)
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

回答(1 个)

Muhammet Dabak
Muhammet Dabak 2020-11-11
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.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by