Jump to content

Navigational Findings


Alienhead
 Share

Go to solution Solved by Josh,

Recommended Posts

Is NavMesh creation currently turned off in the editor? Nothing happens whatsoever when I click Build NavMesh. just wondering

Strike that, I just realized I was doing it wrong.

 

  • Haha 1

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

Josh, can you expose the NavMesh class to lua? 

I need to access an editor created Navmesh but i cant cast it and lua thinks its Entity class.

So CreateNavAgent(navmesh) fails.

navmesh = NavMesh(navmesh) or 

nav:As<NavMesh>()

 

 

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

Also trying to mimic the creation in code results with an error:

 

 
                navmesh = CreateNavMesh(world, 100, 64, 64, 32, 0.25, 0.4, 1.8, 0.5, 45)

CreateNavMesh(shared_ptr<World> world, const float height, const int tilesx, const int tilesz, const int tileres = 32, const float voxelsize = 0.25, const float agentradius = 0.4, const float agentheight = 1.8, const float stepheight = 0.501, const float maxslope = 45.01)

image.thumb.png.95a062668d6e42b094225b54d3ff793d.png

 

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

  • Alienhead changed the title to Navigational Findings

Adding to this list:

In order for me to attach a NavAgent to a entity already in the world I have to move the entity to 0,0,0 and rotation 0,0,0 then attach it, then SetPosition() and SetRotation() the agent back to the normal spot for it to work. Simply creating the agent, moving it to pos and rot then attaching it causes some weird effects usually resulting in the model/entity being placed all about the map. 

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

  • Solution
  • Added NavAgent:Stop
  • Added NavMesh() casting function
  • Added the missing CreateNavMesh overload

These will be included in the next build that goes up.

On 5/18/2024 at 9:45 AM, Alienhead said:

In order for me to attach a NavAgent to a entity already in the world I have to move the entity to 0,0,0 and rotation 0,0,0 then attach it, then SetPosition() and SetRotation() the agent back to the normal spot for it to work. Simply creating the agent, moving it to pos and rot then attaching it causes some weird effects usually resulting in the model/entity being placed all about the map. 

When an entity is attached to an object, it's local orientation is preserved relative to the parent. This might be a design decision that should be revisited, but it is currently working as intended. I don't think you need to move the agent, the entity's global orientation at the time of attachment will turn into its relative orientation to the attached object.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

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