Hi, I’m running a clothing store, but I’m having a big problem with the menu cameras !
Let me explain now, I have a fixed camera, the code below
function CreateCamHaut()
local coords = GetEntityCoords(GetPlayerPed(-1))
camHaut = CreateCamWithParams('DEFAULT_SCRIPTED_CAMERA', coords.x+1.8, coords.y-0.0, coords.z+0.7, 0.0, 0.0, 0.0, 39.0, true, true)
PointCamAtCoord(camHaut, coords.x, coords.y, coords.z+0.1)
RenderScriptCams(true, false, false, true, true)
end
The problem with this code is that depending on the menu item, it happens that the camera enters a wall
I would like to try to make the same camera style as the /skin menu, but I can’t do
Hmmm - From what you posted in your first post, it looks like you’re trying to add some random value to the camera coordinates. Is there some reason you were doing so? It may be useful to use static coordinates if:
It’s only one or a few shops
They’re the same orientation
There’s only a few points within each store that will need your specific camera
If NONE of these apply, or you will want the script to be auto expanding, you’ll need to come up with an idea for an algorithm that can test various coordinates and detect if a given coord expands the boundaries of the store.
One good native you can use for that are the “angled area” natives. Search “Angled Area” here.
This will allow you to answer the question "Is my camera point inside the angled area of the store?, and adjust your coordinates accordingly.
Note you’ll still need to save static points like the center of the store. If you can find a way to detect walls in your script, as well it may make your camera placement code more efficient.
Lastly, since these will likely be interiors there may be interior based natives that will be able to help you. Search for “interior” on the same page.
From there, if you need more briainstorming, just let us know!
(Note that this is also just one approach - there are many others out there as well! )
So in fact my script is not like the others, there are different points for tops, bottoms, shoes… and the problem is that I had put coordinates in a store (or I had created the script) except that when I converted the other stores, I saw my error
Oh, that’s no problem at all. What may help you is working to make it universal. If you’re not comfortable sharing your code, can you at least give us an outline of how it works (explain it as if you’re explaining it to a kid).
E.g.
You walk up to the marker
it grabs the coords of the player
it performs some math on the coords
then it creates the camera and points it at the coords
Etc, etc…
If you’re not comfortable doing that, then you’ll at least need to find a way to shift your algorithm so that the code performs universally.
For example: Let’s say your code shifts north when you walk up to the ‘suits’ rack because north is where your desired position is for the original store…
And let’s say after converting it to work in other stores, you realize, a blind north-shift is too generic and can place the camera behind a wall…
In this case, you may need to leverage a universal frame of reference such as the shop keeper or the front door. Something that every store has so that your code can use that to orient itself to the room and start identifying good camera positions.
Yes, I know that, the thing I would like to do is like /skin, but I went to look at its code, but don’t understand everything about how it works and sorry for the lack of detail, English is not my native language
Should be updated, but basically how it works is:
Say you wanted to get 7 meters above the player (whereever he goes):
You can use GetEntityMatrix as follows:
forwardvector, rightvector, upvector, position = GetEntityMatrix(player)
--this assumes player is set somewhere else
newlocation = (upvector * 7) + position
If you wanted to get the location under the player, use a negative number like -7. The same applies for the forward vector and right vector. All are oriented to the target…