YouGroove Posted February 12, 2015 Share Posted February 12, 2015 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. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 13, 2015 Share Posted February 13, 2015 self.target might be nil. That's generally why things crash. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 13, 2015 Author Share Posted February 13, 2015 Nope Rick, Otherwise the mob would not be chasing my player when i run the game. It's a field where i drop player entity : Script.target=nil--entity "Target" Quote Stop toying and make games Link to comment Share on other sites More sharing options...
cassius Posted February 13, 2015 Share Posted February 13, 2015 This works for me ( in c++) badguy.model->Point(jane.model, 2, Time::GetSpeed()*0.1); Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
YouGroove Posted February 13, 2015 Author Share Posted February 13, 2015 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 ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Gonan Posted February 13, 2015 Share Posted February 13, 2015 try replacing self.targert,2,1 with self.target,2,1 in your last line. 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 13, 2015 Author Share Posted February 13, 2015 Thanks I will ask on suggestions a new Lua editor i think to avoid that style of problems. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Gonan Posted February 14, 2015 Share Posted February 14, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.