Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between jump and fall #3

Open
mrpacogp opened this issue Mar 1, 2021 · 9 comments
Open

Difference between jump and fall #3

mrpacogp opened this issue Mar 1, 2021 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@mrpacogp
Copy link

mrpacogp commented Mar 1, 2021

Hi guys thanks for the project
I have take a look and see how works parabola, curva etc... while in link on navmesh, but how can i get if i need to fall or jump to play any animation during this event instead of teleport to destination point?

@idbrii
Copy link
Owner

idbrii commented Mar 3, 2021

You can distinguish between navgen's fall and jump two navlink prefabs with NavMeshLinkData.bidirectional.

Look at how the NavMeshComponents example AgentLinkMover traverses links. Instead of immediately starting your movement coroutines, you could check the navMeshOwner to access the prefab:

var link = agent.navMeshOwner as NavMeshLink;
bool is_fall = link != null && !link.bidirectional;

// or create a NavLinkData script and add it to your prefabs 
// so you can get any data out of them you want
// (including an animation or animparam):
var my_link_data = link.GetComponent<NavLinkData>();
PlayAnim(my_link_data.animation);

NavMeshLink also lets you set an area, so you could look at that value for multiple categories of links.

@idbrii idbrii added the documentation Improvements or additions to documentation label Mar 3, 2021
@mrpacogp
Copy link
Author

mrpacogp commented Mar 3, 2021

You can distinguish between navgen's fall and jump two navlink prefabs with NavMeshLinkData.bidirectional.

Look at how the NavMeshComponents example AgentLinkMover traverses links. Instead of immediately starting your movement coroutines, you could check the navMeshOwner to access the prefab:

var link = agent.navMeshOwner as NavMeshLink;
bool is_fall = link != null && !link.bidirectional;

// or create a NavLinkData script and add it to your prefabs 
// so you can get any data out of them you want
// (including an animation or animparam):
var my_link_data = link.GetComponent<NavLinkData>();
PlayAnim(my_link_data.animation);

NavMeshLink also lets you set an area, so you could look at that value for multiple categories of links.

Wow! thank you very much for support and reply.
Right now i can test this, yesterday i stop using links because sometimes my characters rotate to wrong position, i mean, i launch my character to some wall on the house, and he starts moving from the wall but the other side, and the agent is moving inside lol idk why, i do navmesh hit and everytime return the same normal...
The same problem sometimes when i try to move to ceiling, figure a house, and is floor 0, i want to launch to ceiling on floor 0 but the character moves to floor 1 instead of ceiling in floor 0. this is using link, i get so many problems, maybe im a but noob and documentation in unity is a bit poor.

@idbrii
Copy link
Owner

idbrii commented Mar 3, 2021

Unfortunately, I don't think navgen will handle overlapping surfaces very well (like two floors in a house).

But you can place the navlinks yourself as well -- you don't have to generate them.

NavMeshComponents documentation is a bit weirdly separate from the other navmesh docs, but there is a manual section that's worth looking into.

@mrpacogp
Copy link
Author

mrpacogp commented Mar 4, 2021

Unfortunately, I don't think navgen will handle overlapping surfaces very well (like two floors in a house).

But you can place the navlinks yourself as well -- you don't have to generate them.

NavMeshComponents documentation is a bit weirdly separate from the other navmesh docs, but there is a manual section that's worth looking into.

Thank you very much for support.
We have some places with one trigger where my agent will be moving from ceiling to floor with one custom animation.
This is the same way like this?
"// or create a NavLinkData script and add it to your prefabs
// so you can get any data out of them you want
// (including an animation or animparam):
var my_link_data = link.GetComponent();"
About this, you mean, i can create a navlinkdata and check if agent is on navmesh link and then check if have this class and what info really? but if you want to move from ceiling to floor and from floor to ceiling you must check endPos and startPos to see if you are falling or jumping really?
The question is, if you want this function in to whole floor or ceiling you must create a giant navmesh link?
Well its my dude sorry for disturbed you.
At this time what im doing is, if pathstatus is pathpartial and remainig distance is less than 1.2 (for example)then jump to floor o ceiling because you are in wrong navmesh surface.
What im trying to make is a funny game where there is an enemy in ceiling chasing you, and for prevent poor behaviours i want he to chase player in every surface, but when i have baked walls conecting them with floor and surface with navmesh link is when become my problem to walking in the wrong face of this surface.
thanks anyway for suggestion and apologies about my english.

@idbrii
Copy link
Owner

idbrii commented Mar 4, 2021

About this, you mean, i can create a navlinkdata and check if agent is on navmesh link and then check if have this class and what info really?

Yes. Be sure you add the NavLinkData component to the prefabs that you set in NavLinkGenerator.

but if you want to move from ceiling to floor and from floor to ceiling you must check endPos and startPos to see if you are falling or jumping really?

Yes, you'd have to check if you're closer to the startPos or endPos to see if you should jump up or down for bidirectional links.

@mrpacogp
Copy link
Author

mrpacogp commented Mar 5, 2021

About this, you mean, i can create a navlinkdata and check if agent is on navmesh link and then check if have this class and what info really?

Yes. Be sure you add the NavLinkData component to the prefabs that you set in NavLinkGenerator.

but if you want to move from ceiling to floor and from floor to ceiling you must check endPos and startPos to see if you are falling or jumping really?

Yes, you'd have to check if you're closer to the startPos or endPos to see if you should jump up or down for bidirectional links.

thanks for suggestion, is possible to have a navmesh link that cover the whole floor to ceiling? figure a situation where enemy is chasing player from ceiling and need to fall to floor to continue chasing him, i think navmesh link is not useful here really? we cannot tell the enemy to search for some wall and move down, maybe its better if path is partial to player to jump to floor and use aninmation here really? instead to use navmesh link from ceiling to floor

@idbrii
Copy link
Owner

idbrii commented Mar 5, 2021

navgen should be generating navlinks that go from high ground to lower ground: high ground to lower ground

That would allow your enemy agent to pathfind to the player from the upper floor, through the link, and to the lower floor.

If it's not, try increasing the "Max Vertical Fall" value. And check your prefab setup.

@mrpacogp
Copy link
Author

navgen should be generating navlinks that go from high ground to lower ground: high ground to lower ground

That would allow your enemy agent to pathfind to the player from the upper floor, through the link, and to the lower floor.

If it's not, try increasing the "Max Vertical Fall" value. And check your prefab setup.

Hi there! sorry for disturbed you againt!
I have the last problem, im doing an animation while jumping from ceiling to floor, but if my link is rotated 180 in Z axis, my character turn in good direction, if the link is rotated in Z 0 degree is working wrong.
Im reading documentation but i cannot find how to avoid offMeshlink rotation, also trying to disable updateRotation while in offMeshLink and disabled agent but i cannot get nothing working >.<
Do you have this issue ?

@idbrii
Copy link
Owner

idbrii commented Mar 31, 2021

if my link is rotated 180 in Z axis, my character turn in good direction, if the link is rotated in Z 0 degree is working wrong.

You mean you have something like the above screenshot (a cube with links dropping down from it) but only some directions work properly? Can you post a screenshot of your links and which ones work correctly?

Possibly navgen is placing the links incorrectly -- likely because your geometry is too complex for us to handle. You may need to move some of the navlinks out from under the "Generated NavLinks" gameobject to manually adjust them to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants