Overkillz

Get elements under me

Recommended Posts

Hello guys, Im planning to create an script which draw whatever I want(For example an image)  under my PED, but when i have been thinking about it a lot of questions came to me.

First of all I know that I will have to use shaders to reeach my goal.

But here are my main question. How do I get the elements that are under me. I have been thinking for a vehicle with 

onClientVehicleCollision

but i want with the peds. 

Another question is, what about if Im in the middle of 2 objects like on this image

Spoiler

mta-screen_2019-10-09_00-40-28.png

Otherwise, What about if the ped is flying or whatever (It is supossed that he is not touching the ground) so how could I deal with it.

I don't know where to start with this, I hope you can bring me a hand.

Thanks for reading. Regards.

Share this post


Link to post

What you want to earn called texture projection. I never did it before in MTA, but I guess you could make it.
Here is a good description with codes:
http://www.rastertek.com/dx11tut43.html

In my understanding, by getting the world coordinates and your camera direction, you can project a texture into the world. You can get these matrices from the mtasa-helper.fx, you can get it from the wiki:
https://wiki.multitheftauto.com/wiki/Element/Shader

 

Sometime I see, that scripters earn this effect by drawing a picture into the 3D world and place it with the element coordinates, combined with the ground level. I know its not showing good on uneven ground, but more easier to implement.

 

dxDrawMaterialLine3D()
getGroundPosition()

 

  • Like 1

Share this post


Link to post

@Awang @IIYAMA

I have been doing some researchs about it and ...

Well, I think instead of

getGroundPosition()
onPlayerContact

I could use 

 
isLineOfSightClear()

Due to what about if the player enter in a vehicle (I want to keep the image) under the car. Also. I have been reading some shaders code which were previously mentioned by Awang and I have seen that all of them have a list of textures added to apply the effect over them. (This might could solve the problem for the uneven grounds)

And might the best way to take reference for my goal is to read carefully the code of @Ren_712 The Dynamic Lights Script (https://community.multitheftauto.com/index.php?p=resources&s=details&id=9398)

But I have a question. Do Im still needing to use dxDrawMaterialLine3D() to reach the goal ? Might create a texture would be a better option if I just want to draw an image.

What do you think about this ?

Thanks for reading. Best regards.

Share this post


Link to post
Posted (edited)
15 minutes ago, Overkillz said:

What do you think about this ?

Are you going to create lights under the ped his feet? Or a shadow as image? Hmmmhmmhmmmmm

Could work, but it is still not clear what the ultimate goal is.

 

 

Btw. See also this function:

https://wiki.multitheftauto.com/wiki/ProcessLineOfSight

It it doesn't only tell you if the line is clear, it also detects the collision position. (And much more: material,  surfaces orientation,  vehicle parts)

Edited by IIYAMA
  • Like 1

Share this post


Link to post

@IIYAMA

Yes, the right word woluld be a shadow (But an image as shadow)

I have been several Topics around the community and I have been reading that adding a shadow to the COL could solve my problem even more.

But could someone tell how do COLS work ?

Thanks for answering :)

Share this post


Link to post
1 hour ago, Overkillz said:

Yes, the right word woluld be a shadow (But an image as shadow)

For this you indeed need to use dxDrawMaterialLine3D.

 

 

1 hour ago, Overkillz said:

But could someone tell how do COLS work ?

This is actually not the right section for details about COLS (collision files). (unless it is only for the replacement code)

 

You will have more luck with that in:

https://forum.mtasa.com/forum/177-modelling/

+ you can figure out which people have knowledge about it.

 

 

  • Like 1

Share this post


Link to post

@IIYAMA

Well, assuming that I will chose the way of dxDrawMaterialLine3D. Will I be forced to use shaders if I want to reach a similar effect for uneven grounds right ?

  • Like 1

Share this post


Link to post
53 minutes ago, Overkillz said:

@IIYAMA

Well, assuming that I will chose the way of dxDrawMaterialLine3D. Will I be forced to use shaders if I want to reach a similar effect for uneven grounds right ?


Yes, correct.

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.