Aller au contenu

Photo

Testing Validity of a Vector


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
JediMindTrix

JediMindTrix
  • Members
  • 283 messages

I am utterly clueless as to how I would go about coding this. Is there a way to test if a vector is in a valid location (I.E. three yards into the blackspace of a wall?)



#2
Shadooow

Shadooow
  • Members
  • 4 465 messages

well... option 1 is to create an invisible creature on those coords and then get her location and compare it - if it differs the vector is in nonwalkable spot.

 

option2 is nwnx it has GetSurfaceMaterial function which can be used to test this



#3
Baaleos

Baaleos
  • Members
  • 1 322 messages

I use option 1 for my Rift System in my PW.

At random intervals, a random area is chosen (above ground, outdoors)
Then a random location is selected - 

I spawn an invisible creature, get its location then destroy the creature.

 

If the location's X and Y do not match the vector I targetted, then I know that the location was not valid.

The thing to remember about Z axes is that even a little bit of debris or change in elevation on the ground can affect the Z axes of the creatures standing location.
So you might want to disregard the Z part of the vector, or at the very least append some buffer to the z axes if you are planning on spawning anything in the air at that location.

Eg: I do : Z = creatureLocation.Z+4; or something like that.

Result is a rift system that spawns at always 'valid' locations. (Note - it can still spawn in inaccessible areas though)
Below is an early POC I did (before it was refined) - I was planning on using tilemagic to turn water in the area to lava when a fire rift spawned etc
Worlds_of_Rhun_0005a.jpg



#4
JediMindTrix

JediMindTrix
  • Members
  • 283 messages

Thanks guys, this was tremendously helpful. Option 2 was used, I believe.