Jump to content

Allign camera to object vector3


Slastraf
 Share

Recommended Posts

Script.entity2 = nil --entity "allignto"

 

function Script:Start()

self.camera=Camera:Create()

self.camera:SetFOV(90)

self.camera:SetRange(0.05,1000)

self.camera:SetMultisampleMode((System:GetProperty("multisample","1")))

self.camera:SetMass(0)

self.entity:SetMass(0)

end

 

 

 

function Script:UpdateWorld()

 

self.camera:AlignToVector(self.entity2:GetPosition())

 

self.camera:SetPosition(self.entity:GetPosition())

 

 

end

I have no Idea on how to use the AllignToVector method, the only thing happens is that the camera is not pointing at the entitys position.

How can i fix this ?

Link to comment
Share on other sites

maybe this?

 

self.vector = self.entity:GetPosition(true) - self.entity2:GetPosition(true)

self.camera:AlignToVector(self.vector:Normalize(),2)

experimented a bit and figured out it was the other way around ;)

self.vector = self.entity2:GetPosition(true)-self.entity:GetPosition(true)

self.camera:AlignToVector(self.vector:Normalize(),2)

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...