Jump to content

Get position of world models


Bonsai

Recommended Posts

Hey,

is there a way to get the position of world models, meaning the objects of the defaut San Andreas map?

In the Map editor you can only select them, which automatically changes their position.

I want to recreate them with new objects on their original position.

 

Bonsai

Link to comment
  • Discord Moderators

Or just creating a simple script :D

 

local posTable = {}

function replaceAllWorldModels()
  for k,v in ipairs(getElementsByType("objects")) do --gets alll the object elemnts in the gta world
    local rotx,roty,rotz = getElementRotation(v) -- gets the rotation
    local posTable[v] = {Vector3(getElementPosition(v)),getElementModel(v),rotx,roty,rotz} -- stores the position, and such thing in a table with key of the element.
	removeWorldModel(getElementModel(v),1000,posTable[v][1]) -- removes the world object
  end 
  for k,v in ipairs(posTable) do
    createObject(v[2],v[1],v[3],v[4],v[5]) -- This creates the object.
  end
end

should work fine.. but still cant understand why the hell u want to replace all the objects..this is laggy btw..

Link to comment

I don't want to replace ALL the objects, only some to I can change their position.

Often, a building etc. consists of many models, so I would have to manually adjust their position again, which would take very long.

I will try checking that file, hopefully the models that belong together are next to each other there.

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...