Function "containerRayCast " with trouble
by Zhangbin · in Technical Issues · 12/18/2005 (5:49 am) · 1 replies
I want to do some "eye's picking" with following script code.
%startPoint = %client.player.getEyePoint();
%Vector = VectorScale(VectorNormalize(%client.player.getEyeVector()),100);
%endPoint = VectorAdd(%startPoint,%Vector);
%obj = GetWord(containerRayCast(%startPoint,%endPoint,0xffffffff,%client.player),0);
echo("========FindObject id:"@%obj@" | player id:"@%client.player@"=========");
Then ,i got the object id in "%obj",but it is not the object (type: TSStatic ) in the center of the player's screen, just the terrain block under it! Why?
%startPoint = %client.player.getEyePoint();
%Vector = VectorScale(VectorNormalize(%client.player.getEyeVector()),100);
%endPoint = VectorAdd(%startPoint,%Vector);
%obj = GetWord(containerRayCast(%startPoint,%endPoint,0xffffffff,%client.player),0);
echo("========FindObject id:"@%obj@" | player id:"@%client.player@"=========");
Then ,i got the object id in "%obj",but it is not the object (type: TSStatic ) in the center of the player's screen, just the terrain block under it! Why?
Torque 3D Owner Martin "Founder" Hoover
I believe these are all the standard typeMasks:
$TypeMasks::StaticObjectType
$TypeMasks::EnvironmentObjectType
$TypeMasks::TerrainObjectType
$TypeMasks::InteriorObjectType
$TypeMasks::WaterObjectType
$TypeMasks::TriggerObjectType
$TypeMasks::MarkerObjectType
$TypeMasks::GameBaseObjectType
$TypeMasks::ShapeBaseObjectType
$TypeMasks::CameraObjectType
$TypeMasks::StaticShapeObjectType
$TypeMasks::PlayerObjectType
$TypeMasks::ItemObjectType
$TypeMasks::VehicleObjectType
$TypeMasks::VehicleBlockerObjectType
$TypeMasks::ProjectileObjectType
$TypeMasks::ExplosionObjectType
$TypeMasks::CorpseObjectType
$TypeMasks::DebrisObjectType
$TypeMasks::PhysicalZoneObjectType
$TypeMasks::StaticTSObjectType
$TypeMasks::StaticRenderedObjectType
$TypeMasks::DamagableItemObjectType
So for your function, you could specify iy like so:
Of course you are not limited to using only one type mask. you could specify a mask like so:
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ItemObjectType);Then simply insert the variable %mask into the rayCast.