altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

Extending object api

Open Konders opened this issue 3 years ago • 3 comments

Description of the problem

Atm there is not exists some methods which people use with createObject natives So, there is not enough functionality to switch to object api

  • [ ] slideObject
  • [x] setEntityCollision(object, false, false); // to toggle collision
  • [x] detach with dynamic parameter
  • [x] freezeEntityPosition
  • [x] placeObjectOnGroundProperly
  • [ ] getCoordsAndRotationOfClosestObjectOfType
  • [ ] And also there is opened question how to correctly provide alt.Object to webview renderer

Desired solution for the problem

add

  • obj.slideObject(vector3,speed:vector3, collision)
  • obj.collision:boolean
  • obj.detach(makeDynamic)
  • obj.freeze:boolean
  • obj.placeObjectOnGround(vector3)
  • alt.Object.all.closest(pos:vector3,radius:float, hash)

Alternatives you considered

No response

Additional context

No response

Version

No response

Konders avatar Aug 08 '22 07:08 Konders

As written in the scripting info post you can use natives together with the object api.

const localPlayer = alt.Player.local;

const object = new alt.Object("sm_prop_smug_crate_s_jewellery", localPlayer.pos, new alt.Vector3(0, 0, 0));

await alt.Utils.waitFor(() => object.isSpawned));
native.setEntityCollision(object.scriptID, false, false);

in the future more apis might be added.

FabianTerhorst avatar Aug 08 '22 11:08 FabianTerhorst

Ok, but I we are talking about future server side object api, I think this is must have things

Konders avatar Aug 08 '22 11:08 Konders

This has low prio for now, because you can do all of these things with natives.

LeonMrBonnie avatar Aug 10 '22 19:08 LeonMrBonnie