Hello@all,
according to Aggror Project Saturn Tutorial about the implementation of a enemy turret, i have some problems with the raycast detections and the collision types.
the scene is setup with the fpsplayer prefab, some csg shapes and the fpsautopistol.mdl with a directional light as muzzlefash.
i enhanced the turret script with additional informations from pickinfo class
if(self.fireRateTimer > self.fireRate) then
local pickinfo = PickInfo()
local source = self.entity:GetPosition()
local target = Transform:Point(Vec3(0,0,self.WeaponRange),self.entity,nil)
if (self.entity.world:Pick(source, target, pickinfo, 0, true, Collision.Prop)) then
local text = pickinfo.entity:GetKeyValue("name","default") --the object that was picked
local hit = pickinfo.entity:GetPosition(true) -- the global position of the object
local point = self.entity:GetPosition() -- the position of the turret
local dis = point:DistanceToPoint(hit) --the distance from turret to the object
System:Print(hit)
System:Print(text)
System:Print(dis)
pickinfo.entity:Hide() --so when the entity itself is disappearing, i can figure out which it is ;)
end
When the turret is doing the pick operation the informations which are stored in the hit, point, dis variables looks fine for me, just the text returns "default".(this means the entity has no name property)
My FpsPlayer has a name assigned, so i guess whatever the pick is hitting, it is not the fpsplayer.
i extented the script with the line: pickinfo.entity:Hide() and the first "pick" hits something and after second "pick" the csg shape below my charctercontroller disappers
How can i figure out what was picked(for curiosity) and then doing the correct collision type for the raycast only intersect with the character controller.
i remember there was table with the collision types but i couldnt find it.
Thanks for any help