Jump to content

Help with the rays!


Yue
 Share

Go to solution Solved by Yue,

Recommended Posts

I have a beam that comes out from the player and positions the camera when at the collision point of that beam. Everything works fine, if you use brushes and terrain inside the editor, but if I carry a mesh, it doesn't seem to work properly.


 

function this:RayCamera()

				self.pickInfo = PickInfo()

				self.ray = self.world:Pick(self.pivotPlayer:GetPosition(true)   ,self.pivotCamera:GetPosition(true), self.pickInfo, 0, false, Collision.Debris)
		
				self.cameraPlayer:SetPosition(self.pivotCamera:GetPosition(true))
				
				self.cameraPlayer:Point(self.pivotPlayer)
				if self.ray then 
					self.cameraPlayer:SetPosition(self.pickInfo.position + (self.pickInfo.normal/12),false)
					self.cameraPlayer:Point(self.pivotPlayer)
				else 
					--self:MoveToPoint(self.cameraPlayer,self.pivotCamera:GetPosition(true),0.1)
				end 
				
				
			end

 

 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...