green circle over the player (surface?)
Blitz3D Forums/Blitz3D Beginners Area/green circle over the player (surface?)
| ||
Hello i'm new to b3d. I'm making a small test. I would like to create a green circle over the player. Example : ![]() I don't know how to solve the problem. A small and easy example would be apprecited Thank you Rufio |
| ||
Looks like Spellforce ^^ :D Anywho, not that I've really done anything similar myself, the principle is fairly straightforward I think, and for all intents and purposes is essentially the same kinda thing as adding a simple shadow under a mesh... I think there's 2 main ways to approach this, I have no idea which is preferred... One way, is to superimpose a sprite (or better yet, an infinitely tihn, one-sided mesh) over the terrain. The other, is to temporarily blend a new texture onto the terrain. I'm not really able to give much in the way of code for this, but, at least, here's how I'd approach the situation (using the first method) 1) Identify the actual triangle(s) under the 'selected character' 2) Work out the geometry of these triangles, particularly, the most obvious angle to use. 3) Create a flat, thin, 'quad' mesh or a sprite with the 'independant from camera' view mode. *** 4) Rotate the quad/sprite to match with the triangle of the terrain's angles. 5) place the flat mesh centred under the character with a slight difference in the 'Y' value (height) - If necessary, alter the EntityOrder value so the circle might show even if 'hidden' by something else? *** In situations where you may have LOTS of 'units selected', it would perhaps be beneficial to make use of a 'single-surface' mesh. Instead of creating a new mesh each time, this method would sinply involve using AddMesh. |
| ||
Work out the centre of the player. Shoot a LinePick downwards from above the players co-ords. Then use AlignToVector, plugging in the appropriate PickedNX() NY() and NZ() and the correct axis (It should be the Y axis i think) |
| ||
Yes thank you. But... suppose that the ground isn't flat or uniform. Because, for example, on the ground there are rocks and foliage. I need to project the green circle image on the floor. And this projection should adapt itself to a non uniform surface. This is the problem. Any idea ? Rufio72 P.S. Thank you for your suggestions and sorry for my bad english |
| ||
Terrain has no relevence. The drawing order of the circle is what counts - The EntityOrder of the ring will take care of things. EDIT: You don't apply it or align it to the ground - forget about the ground or terrain - just parent it to the character mesh. |
| ||
Because, for example, on the ground there are rocks and foliage. I need to project the green circle image on the floor. And this projection should adapt itself to a non uniform surface. As mentioned by RossC, using AlignToVector will work if the terrain is at an angle. Because Ross' suggestions use Linepick as well, any other foliage or such in the way will be considered. To be honest, though, I think such detail in the deforming of the 'selection circle' is overkill - Puki's idea will be much quicker and simpler. |
| ||
ok i'll try. Thank you very much for your time |
| ||
Ok it is working. This is the result. I have to improve, but at the moment it is enough. Bye result: ![]() |