[FREE][tool] Object Camera

What is it?

This is a Camera module that will attach and follow and object. it will allow you to rotate around it similar to how your camera rotates around the player. do what you want with it

Preview

Click Here If Video Doesnt Load

ReadMe

Camera Module - object_camera

This README is aimed at providing guidance on how to use the exported createObjectCam function from the object_camera module in the FiveM framework using Lua.

Installation

  1. Download the object_camera resource.
  2. Extract the object_camera folder into your server’s resources directory.
  3. Add start object_camera to your server’s server.cfg file.

You should now be able to use the createObjectCam function in your scripts: exports['object_camera']:createObjectCam(object, options)

Export

exports("createObjectCam", createObjectCam)

Functions

createObjectCam(object, options)

  • object: The entity at which the camera is pointed.
  • options: A table with camera settings, including rotationSpeed, zoomClamp, startingZoom, and zoomStep.

Default camera options:

local defaultCamOptions = {
    rotationSpeed = 0.15,
    zoomClamp = {min = 0.25, max = 3.0},
    startingZoom = 3.0,
    zoomStep = 0.05,
}

If options are not provided, these default options are used.

Usage

First, ensure the object_camera module script is running on your server.

The createObjectCam function can be used in any Lua script on the server or client side as follows:

local object = --[[@ Your target entity]]
local options = {
    rotationSpeed = 0.3,
    zoomClamp = {min = 0.25, max = 10.0},
    startingZoom = 5.0,
    zoomStep = 0.25,
}

exports['object_camera']:createObjectCam(object, options)

Test Command

A command testObjectCam is registered in this module to test the camera functionality. Usage: /testObjectCam model, replace model with the hash of the model you want to spawn and view.

RegisterCommand("testObjectCam", function(source, args)
    local model = joaat(args[1])
    RequestModel(model)
    local timer = 50
    while not HasModelLoaded(model) and timer > 0 do
        timer -= 1
        RequestModel(model)
        Wait(100)
    end
    local coords = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 3.0, 0.0)
    local object = CreateObject(model, coords.x, coords.y, coords.z, false, false, false)
    FreezeEntityPosition(object, true)
    createObjectCam(object, {
        rotationSpeed = 0.3,
        zoomClamp = {min = 0.25, max = 10.0},
        startingZoom = 5.0,
        zoomStep = 0.25,
    })
end, false)

Controls

While in the camera view, the following controls apply:

  • Zoom in: Scroll Up
  • Zoom out: Scroll Down
  • Exit camera view: ESC

Note

The camera will be locked on the entity even if it moves. The camera’s perspective will not change unless the entity does.

3 Likes

Nice UE5 screen :man_facepalming:

I believe it was for the presentation, or for people who will ask “Why there is floating table as picture?”.
Seriously people in this community need to stop lurk around try to find every negative in the posts.

3 Likes

Well you could at least get creative instead of posting a screenshot from a different software.

Amazing work, thank you for share it!

1 Like

needed some picture that actually represents a camera. better than leaving the post without an image. thanks for the feedback

1 Like

Cool idea, cheers.

Your welcome. Though I’d suggest making something of own for a thumbnail or what ever. You know it looks better :slight_smile:

can you show me an example thumbnail from your releases?

cry more, this community is a shit show

1 Like

This is very good and I will definitely use it, you could implement it to show the coordinates, it would make it much easier when using CreateCamWithParams/CreateCameraWithParams

2 Likes

child

How bout you look at the releases tab. There’s plenty of em there

There you go pal. Now go make one for your handwashing script. :soap::clap:t2: