Jump to content

Question about snapping objects


bradio10

Recommended Posts

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 :P

Here is an image of what I mean:

lYJdd2l.jpg

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

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

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.
×
×
  • Create New...