Coder Social home page Coder Social logo

object_gizmo's Introduction

Object Gizmo

This is a FiveM resource that lets you control any object using the threejs Transform Controls. This is meant mainly as a tool for developers to use to create their own systems. a furniture system for example. created by me from just gutting logic from dolu_tool and creating an export essentially.

Installation

  • drag into your resources
  • add ensure object_gizmo to your server.cfg

how-to

there is an example in the test.lua file. (you will probably want to remove this file before using this in production)

exports.object_gizmo:useGizmo(object)

--example of how the gizmo could be used /spawnobject {object model name}
RegisterCommand('spawnobject',function(source, args, rawCommand) 
    local objectName = args[1] or "prop_bench_01a"
    local playerPed = PlayerPedId()
    local offset = GetOffsetFromEntityInWorldCoords(playerPed, 0, 1.0, 0)

    local model = joaat(objectName)
    lib.requestModel(model, 5000)

    local object = CreateObject(model, offset.x, offset.y, offset.z, true, false, false)
     --export for the gizmo. just pass an object handle to the function.
    local objectPositionData = exports.object_gizmo:useGizmo(object)
    
    print(json.encode(objectPositionData, { indent = true }))
    
    -- return value of the export
    -- {
    -- handle: objectid,
    -- position: vec3,
    -- rotation: vec3
    -- }
end)


preview

https://streamable.com/bp4oqp

Credits

The react logic for the gizmo came from dolu_tool which was worked on by all of these fine people.

object_gizmo's People

Contributors

demigod916 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.