Jump to content

Raycast Issue


brndx
 Share

Recommended Posts

Almost all of the door models are not detected when performing a raycast unless they are the sliding doors included with Leadwerks. This occurs despite the same script operating on each door and every material having pick mode enabled.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

The collision type is prop and getting the distance will not do as the problem is with the camera passing through the door rather than interaction.

 

The raycast works fine here as the info box and interaction are working:

 

tFiTpg8.png

 

 

and here the camera passes through the door when it doesn't for the models included with leadwerks:

 

fnvl9kV.png

Link to comment
Share on other sites

if self.target==nil then return end
if hoverplayer ~= 1 then
self.distance = 0.8
self.pickradius = 0.2
local originalcamerapos = self.entity:GetPosition(true)
local targetpos = self.target:GetPosition(true)
local newcamerapos = self.target:GetPosition(true)
targetpos.y = targetpos.y+camheight
self.entity:SetPosition(targetpos)
self.entity:Move(0.4,0,-self.distance)
local targetpickmode = self.target:GetPickMode()
jill.script.target:SetPickMode(0)
newcamerapos = self.entity:GetPosition()
local pickinfo = PickInfo()
if (self.entity.world:Pick(Vec3(targetpos.x+0.1,targetpos.y,targetpos.z),self.entity:GetPosition(),pickinfo,self.pickradius,true)) then
    if pickinfo.entity:GetCollisionType() ~= 4 and pickinfo.entity:GetCollisionType() ~= 0 then
						    newcamerapos = pickinfo.position
    jill.script.target:Hide()
newcamerapos.x = Math:Curve(originalcamerapos.x,newcamerapos.x,100/Time:GetSpeed())
newcamerapos.y = Math:Curve(originalcamerapos.y,newcamerapos.y,100/Time:GetSpeed())
newcamerapos.z = Math:Curve(originalcamerapos.z,newcamerapos.z,100/Time:GetSpeed())
self.entity:SetPosition(newcamerapos)
else
jill.script.target:Show()
end
jill.script.target:SetPickMode(targetpickmode)
end
end

Link to comment
Share on other sites

I think the radius of the pick is effected by scale, perhaps, or there may be a box test that isn't accounting for the scale.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 1 year later...
  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...