Jump to content

Simple function


YouGroove
 Share

Recommended Posts

I want to use GotPoint() in a modified GoblinAI lua file.

 

 

function Script:UpdatePhysics()

 

local time=Time:GetCurrent()

 

self.entity:GoToPoint(20,-25,0,1.4,1);

 

--Check for a new target in the area

if not self.target then

...

It don't works, the character where i have binded AnimationManager and my new Lua File with the code above don't move (i put character controller for physics also in the editor)

 

Does anyone have some idea ?

 

self.entity refers to the 3D model on the scene (binded to that script) , or i'm wrong ?

Stop toying and make games

Link to comment
Share on other sites

Here is my code for simple AI i attached to a character model :

 

 

 

function Script:Start()

if self.entity:GetMass()==0 then self.entity:SetMass(1.0) end

--self.mass = self.entity:GetMass()-- save initial mass value

--self.entity:SetMass(0)

end

 

 

function Script:UpdatePhysics()

local time=Time:GetCurrent()

self.entity:GoToPoint(20,-25,0,1.4,1);

self.entity.animationmanager:SetAnimationSequence(self.sequence.walk,0.04,200)

end

 

 

 

function Script:Cleanup()

ReleaseTableObjects(Script.sound)

end

 

***************

 

Why this not works ?

Stop toying and make games

Link to comment
Share on other sites

My fault, doing copy/paste and not pay attention to the function parameters.

Thanks a lot it worked smile.png

 

 

I put some imported FBX model, i select rigid body collision with fit shape , but the character only avoid BSP and seems to go throught models.

Perhaps a bug, or does the function only works in BSP geometry ?

Stop toying and make games

Link to comment
Share on other sites

Try setting the nav obstacle parameter to true, it's the bottom most check mark on the physics tab

 

post-5181-0-65220000-1362271078_thumb.png

 

One helpful setting that you can use if you are working with the navigation system, is to turn on the show navigation in the editor. View->Show Navigation

 

post-5181-0-13734900-1362271242_thumb.png

 

hopefully this helps

Link to comment
Share on other sites

Thanks Chris :)

 

I had nav obstacle to true already and it was a box rigid body , but it didn' appear on the physic view.

 

I clicked on FIT SHAPE and it worked, the cube collision appeared on the physic view.

 

That's strange , could not the "FIT SHAPE" automatically process when you put some object you want collision on it ?

What is the interest to have to click on FIT SHAPE ?

Stop toying and make games

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