Jump to content
JohnBobSmith

AI runs on spot/wont attack player

Recommended Posts

Hello all. As I am experimenting with Leadwerks, I have come across a strange issue. My monster runs on the spot, and wont chase the player. I am using all the default scripts and assets. Heres what I have done:

 

-Drag the player prefab into the 3D viewport

-Drag the monster prefab into the 3D viewport

-Drag the player prefab from the scene view to the target slot of the monster's monsterAI.lua script.

-Run the game

-Monster runs on spot and doesnt attack the player unless I am really close and even then I need to shoot the monster to initiate the attack...

 

I'm probably missing something obvious, but this is strange nevertheless.

 

The desired result is that the monster(s) will find and run towards the player and attack the player.

 

All help appreciated!

Share this post


Link to post

Don.t know about lua, but there is a "follow" command in the command reference.It will make enemies follow main character.

EDIT; providing you build navmesh.

Share this post


Link to post

Where can I find the command reference? Also, it seems strange that the default monster does not have this feature built in. Whats a navmesh and how do I make one?

 

Again, sorry for sounding stupid. I will google around and post back my answers here if I find any. Thanks for the help!

Share this post


Link to post

Hm, alright. Now to figure out why I can run through a stock barrel (it appears to have no collision)... I will google that now.

 

Use the prefab barrel it's already set up for physics

Share this post


Link to post

To give entities collision they need a Physics Shape. See the physics tab of the entity.

You can choose a collision type for the entity to make it collide with other entities. See collision reference here - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/collision-r778

 

Then if you want the entity to move when it collides it needs a mass above 0. If you want it to stay still (Like the ground, walls, ceilings) give it a mass of 0.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...