• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by phxvyper · Oct 15, 2012 at 07:36 AM · pathheightrampfindingelevation

Path Finding With Different Elevations

So, given that i have that i have an enemy who is on a plat form 5 meters higher than the player, and has a ramp going down to player elevation... When i path find, how do i check to see if the drop off of a platform, in this case 5 meters, is greater than 3 meters (or whatever height) and there is another way to get to a position (in this case, the position of the player).

I basically want the enemy who is on said platform to walk down the ramp, instead of walking off the side of the 5 meter high platform (which would cause fall damage). Also, if no other path exists for said enemy to go down that is safer than jumping, he should jump.


Any help is appreciated <3
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Fattie · Oct 15, 2012 at 08:13 AM

quite simply,

have a point we'll call "B" at the bottom of the ramp.

now also have (say) three points (F, G, H) which are where HE WOULD LAND, IF HE JUMPED.

so, forget about where ther guy is standing (on the platform).

path-find separately from B, F, G, H.

make an intelligent decision based on whatever factors you want.

(obviously, once you decide, have him separately move ro B.F.G or H, and then turn on your pathfinding-whatever algorithm for the rest of the travel.)

This is very common, you have to "stage" your pathfinding.

I get concerned generally when beginners get all "a-star!" ............ often it's better to step back .. is there a simpler way?

So, I hope it helps.

It's funny, what you're doing is EXACTLY like GPS engineering in europe

(ie, you have to consider the stupid channel tunnel and that fucking long storebeltsbronenwhatever brucke as special cases that poop all over your otherwise elegant algorithms.)

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image phxvyper · Oct 15, 2012 at 06:11 PM 0
Share

Thanks a bunch, i hope this works! I'll test it out.

avatar image phxvyper · Oct 15, 2012 at 09:39 PM 0
Share

Hmm, so... really i would have to have a point preset at every ramp/staircase in the entire map?

avatar image phxvyper · Oct 16, 2012 at 07:37 PM 0
Share

There would definitely be thousands of ramps or stairs or other paths that would be easier for an NPC in my game to travel rather then going another route. $$anonymous$$y game consists of several islands that are all quite large. So, i guess created different versions of a type of ramp, stair case or whatever each with a point on it would work as long as i reuse it... Otherwise, the estimation of time I'd have to put in would be much longer than previously perceived.

avatar image Fattie · Oct 18, 2012 at 06:31 AM 1
Share

hiya! FTR, I struggle to see what the game would be like. note that pathfinding algorithms just won't work with that many parts.

YES on what you say about putting a script under each ramp. Good luck!

I encourage you to open new separate questions on this one, if you have more interesting issues. You'd have to explain more exactly what the hell the game is, what it looks like, how you made it. Good luck!

avatar image fafase · Oct 18, 2012 at 07:01 AM 1
Share

The script thing about "This is a ramp" why not using a tag ins$$anonymous$$d. You could then retrieve all ramps faster with FindGameObjectsWithTag.

A script saying "I am a ramp" would need find all game objects then reach their script and then compare the string. Reaaaally long process.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

AI Waypoint - Take into account unit Size/Radius? 0 Answers

Zombie A.I path finding help 2 Answers

Grid-based path-finding, similar to Legend of Grimrock/Eye of the Beholder... 2 Answers

A* pathfinding, Re checking nodes 1 Answer

Make a drunk character swerve and loop on the way to a waypoint but still make it eventually. 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges