Jump to content

Pass c++ camera to lua player script


Slastraf
 Share

Recommended Posts

How do I handle the camera creation in c++ ?
I create a camera in c++ and it works fine but the Camera has no GetCurrent() so how do I pass it down to the player script ?
Basically what is the equivalent of entity.script.camera in cpp ?

I need the camera in both c++ and lua.

a.PNG

Link to comment
Share on other sites

There isn't a default way of doing this. You'll need to use the SetKeyValue functions for the camera entity and then do a for loop to find and store the camera into a global variable on the lua side. 

This is why I mostly do everything in C++.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Have just gone "around" this issue like this
 

Quote

world:GetCurrent():ForEachEntityInAABBDo(self.entity:GetAABB(),"Callback",v) 

 

and for some reason the camera was always in the aabb so i just checked if the entity in the parameter of callback was the camera

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