Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Cursor sprite "hugging" the terrain  (Read 1493 times)
Inquisitor
Community Member
*
Posts: 94


« on: May 03, 2004, 06:46:15 PM »

Hi,

I'm wondering how to create a custom cursor sprite (or maybe a mesh) which hugs the terrain. I though at a DynTexture also (which looks really cool), but updating the terrain texture causes me some problems.
It could be also used to display areas on the map, or maybe parts of circle around a Model to show its point of view etc ...

Okay, there's a nice example in the SDK (A18 - Get a landscape position and place a spot) but when you use this routine with terrains like mountains etc ... the sprite is sometimes hidden in the mountain, or some parts of it are hidden. This is dirty (I do not blame the creator of this example, I just say it's not accorded to my needs).

To my mind, DynTexture looks good, but I have no idea of how to check the consistency of the area, as this won't be a mesh  :roll:
So, maybe some of you guys have nice ideas of how to do this thing. I do not need the sourcecode, I just need ideas that I could try to implement ...

Thanks !
Logged
Armendegga_2520
Community Member
*
Posts: 120


« Reply #1 on: May 04, 2004, 11:34:36 AM »

without supplying source code, all i can do is break the problem up foryou into managable steps...

you would obviously need to use some mouse picking with the terrain and then find the first(closest) inter to the camera...

the cursor porbably looks "dirty" because of something knows as an artifact, it occurs when multiple polygons are allowed to intersect, how you wuold avoid this would probbly wind up being one of two ways...

ths first way is that when you get the 3d position back from the mouse picking algorithm, you simply add a value to its y coordinate, like .1 or something. this will make it look as if the cursor is hovering the surface of the terrain and i must admit it looks prety sweet when you get it to wander along at the right height

the second soulution looks rather boring but is far more stable, you take the position of the camera ad the position of where your mouse picking result made contact, the objective is to slide the cursor back along towards the camera. this can be achieved by going like this:

'fade is the ammount you want to move the cursor back
cursor.x = fade*(camera.x - pick.x) + pick.x
cursor.y = fade*(camera.y - pick.y) + pick.y
cursor.z = fade*(camera.z - pick.z) + pick.z

now when fade is "0" the cursor will be at the picking result's location
when fade is "1" the cursor will be at the camers's location
and any number between 0 and one  will move the cursor further of closerto the camera

i really hope this helps  :wink:
Logged
Inquisitor
Community Member
*
Posts: 94


« Reply #2 on: May 04, 2004, 12:28:20 PM »

Thanks for the help, but I already tried it in fact, problem is that is not applicable for large areas.

Just another question :
how about aplpying a SetCubicBezierPatch on the mesh ? and change its coordinates dynamically ? We get the mousepick coordinates, and then get the Land.Getheight at 15 other values around this point (which are forming a circle for example). Then by applying those coordinates to the CubicBezierPatch + texture, we might get a Cursor that takes approximatively the shape of the lanscape. mh ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks