bradio10 Posted April 10, 2014 Share Posted April 10, 2014 Hi, So I am wanting to make a base building system with MTA objects and I have a question. I noticed that when moving objects around, there isn't really an limits as to placing them in the world. Like, I could move the object below the map or up in the sky if I wanted to. I am wanting to know if it is possible to make it so they dont do that and they adapt to the world. So if I move an object onto a hill, it will rotate accordingly to the hill. So instead of sticking into the ground, it will rotate so it won't do that. If you don't understand what I mean and you have played a game called Rust, then what I am talking about is when you try to place objects, the object doesn't just move into the map so you can't see it, it sort of rotates and positions itself to the land. if you still don't understand what I mean, thats ok, I will explain more if you comment below, it's just kinda hard for me to explain Here is an image of what I mean: Can you see how the objects basically adapt tothe land so they tilt and fit properly without going into the ground? Thats what I am wanting to know if it's possible. thanks. Link to comment
Noki Posted April 10, 2014 Share Posted April 10, 2014 Something to do with collisions, and rotating their axies a certain way. You could also use colshapes on the bottom of the object maybe, and create a dummy underneath. Not sure exactly. Link to comment
Moderators IIYAMA Posted April 10, 2014 Moderators Share Posted April 10, 2014 Well this is what you need: To get the size of the object: https://wiki.multitheftauto.com/wiki/Ge ... oundingBox To check where the ground is: https://wiki.multitheftauto.com/wiki/ProcessLineOfSight And of course you need a lot of matrix or trigonometric functions, which I unfortunately do not know to much of. Link to comment
Gallardo9944 Posted April 10, 2014 Share Posted April 10, 2014 as far as i get, you want to be able to create objects fully colliding each other. That way you should use processLineOfSight from the object to the bottom in 5 parts of your object (middle and the corners) and then find the lowest Z value of the collision. So the lowest value will be your desired one. But rotation change would be a pain in the rear end for sure. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now