Collisions in 3D World Editor with Matlab and without Simulink

1 回表示 (過去 30 日間)
Blanca Larraga
Blanca Larraga 2020 年 7 月 17 日
回答済み: Muhammet Dabak 2020 年 11 月 11 日
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 Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by