Jump to content

Point() make a crash


YouGroove
 Share

Recommended Posts

Hi,

 

To point some entity to another i have some few solutions :

1) http://leadwerks.wikidot.com/wiki:face-entity

2) call SetInput(rotation,0)

3) Point() function

 

Trying Point() function it makes crash LE3 ?

 

if self.mode == "attack" then
self.entity:Point(self.targert,1,1)
end

 

I use axis Y as rotation so second argument is 1 and i put 1 on third argument for the speed of rotation.

Does someone have any idea on what i'm doing wrong ?

 

------------------------------------------

 

This function points an entity at another entity.

 

Syntax

  • void Point(Entity* entity, int axis = 2, float rate = 1.0, float roll = 0.0)

Parameters

  • entity: the target entity to point towards.
  • axis: the entity's axis to orient. This may be 0, 1, or 2, for the X, Y, and Z axes, respectively.
  • rate: a multiplier to indicate how quickly the entity should orient itself.
  • roll: the rotation around the specified axis.

Stop toying and make games

Link to comment
Share on other sites

The two first methods works when i launch the game , when i comment and try Point() it crashes.

 

local pos1 = self.entity:GetPosition(true)
local pos2 = self.target:GetPosition(true)
local v = Vec2()

v.y = pos1.x - pos2.x
v.x = pos1.z - pos2.z

local angle = Math:ATan2(v.y, v.x)
--self.entity:SetInput(angle, 0)
--self.entity:SetRotation(0, angle , 0)
self.entity:Point(self.targert,2,1)

 

Must be my system or some cache memory or some restart needed.

If someone can test with Lua ?

Stop toying and make games

Link to comment
Share on other sites

like is there an options explicit type setting that there was in the old VB. This might help users begin to transition to more C++ style if they turn on an option using a tick box in the tools option that says you have to declare all your variables before use.

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