HarryDE Posted August 29, 2019 Share Posted August 29, 2019 Hello. So I'd want to create an object on the cursor position. I have calculated everything, it works fine but there are some objects that do not fit to the calculation. I think the problem can be that the bounding box of this objects are also buggy and I don't know what should I change in my calculation. Calculation: local sx, sy = guiGetScreenSize() local relX, relY = getCursorPosition() cursorX, cursorY = relX * sx, relY * sy local camX, camY, camZ = getCameraMatrix() local cursorWorldPosX, cursorWorldPosY, cursorWorldPosZ = getWorldFromScreenPosition(cursorX, cursorY, 1000) local hit, hitX, hitY, hitZ, hitElement, normalX, normalY, normalZ = processLineOfSight(camX, camY, camZ, cursorWorldPosX, cursorWorldPosY, cursorWorldPosZ, true, true, true, true, true, true, false, true) Picture about it: (The red lines show the bounding box of the object) Link to comment
Administrators Tut Posted August 30, 2019 Administrators Share Posted August 30, 2019 (edited) The most likely cause is the collision of the bed is exported at around -2 offset. This is typically the case for models found in GTA_INT img archive, I don't know why that is. I don't know if you're scripting-wise able to center pivot/axis of the collision to the game mesh or if your only option is to remodel the collision. For the latter solution I'm not sure if it's possible to use engineReplaceModel for other archives than gta3. I think not, at least not player.img. @HarryDE Edited August 30, 2019 by Tut added link 1 Link to comment
HarryDE Posted August 30, 2019 Author Share Posted August 30, 2019 17 hours ago, Tut said: The most likely cause is the collision of the bed is exported at around -2 offset. This is typically the case for models found in GTA_INT img archive, I don't know why that is. I don't know if you're scripting-wise able to center pivot/axis of the collision to the game mesh or if your only option is to remodel the collision. For the latter solution I'm not sure if it's possible to use engineReplaceModel for other archives than gta3. I think not, at least not player.img. @HarryDE I have checked this function in the map_editor and these object are buggy in the map editor too. Is there any possibility to check the "offsets" of these elements? Because then I could just set another offset for this objects. Link to comment
Administrators Tut Posted August 30, 2019 Administrators Share Posted August 30, 2019 (edited) I can compile a list of offsets if you note the obj names. (that is, if it isn't the entirety of interior objs) Edited August 30, 2019 by Tut 1 Link to comment
HarryDE Posted August 31, 2019 Author Share Posted August 31, 2019 12 hours ago, Tut said: I can compile a list of offsets if you note the obj names. (that is, if it isn't the entirety of interior objs) I'd appreciate if you could tell me your technique to get these offsets because there are lot of objects that I want to use and it would be a hard work to compile all the offsets. So I would do this hard work instead of you Thanks in advance! Link to comment
Administrators Tut Posted August 31, 2019 Administrators Share Posted August 31, 2019 I have linked a thread to get started with modeling in one of my previous posts. You'll need to load in collisions from base game and center the pivot to collision model in order to see its offsets on the coordinates display. I'll be looking into writing a guide on how exactly to work with collisions and also how to do your process. @HarryDE Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now