I was wondering, could some of the logic used here be made to make a bomberman and rag n'wahs inspirered openmw alternatives? Those are two really fun mods sadly restricted to MGE EXE
Push, pull and lift work, but grab doesn't. When I press grab, my magicka drains and I can no longer use either push, pull or lift. The magicka drain stays until I reload. Any idea what I'm doing wrong?
This is really cool. I was wondering if I could borrow some lua you wrote, specifically the function to find the crosshair object, to use in my own mod.
I will add you to the description of my mod, and link here.
There's any chance of making it possible to manipulate objects like in Perfect Placement (this mod: https://www.nexusmods.com/morrowind/mods/46562)? Like, just moving them without them rotating
Or that would be impossible in openmw? (I have zero knowledge about scripting)
Hmm... I wouldn't say impossible if you're willing to cut some corners. I'll look at the features and give some comments on potential implementation strategies. I'm looking at it from a "what do we have now" perspective, so I might miss out some OpenMW lua features that is slated for release in the near future (near as in 1-2 years). Apologies for the long post in advance haha:
- Perfect Placement places the item exactly on top of surfaces in horizontal mode, and the back of the item against vertical surfaces while in vertical mode. If you allow objects to clip through other objects (so long as the player can position the items properly) then this is simple. But if you really want the "magnet" effect of it sticking to the surface that will be very tricky.
To me this is the trickiest part because this surface also factors in other items. For collision detection you can use Nearby.castRay lua API for actors and NPCs, but it doesn't work for items; the ray just doesn't detect items and goes through them. For Perfect Placement (PP) it's gotta be perfect so you'll have to rely on castRenderingRay. However, this API endpoint doesn't accept the ignore object parameter, so it is very easy for the ray to collide with, say, the object you're trying to move.
This can potentially be dealt with by computing the bounding box of the object before moving it. For context, the OpenMW lua API currently doesn't provide a way to get the bounding box, but the castRay & castRenderingRay APIs do factor it in when considering collision. So how I get the bounding box for actors/NPCs in this mod is I cast a ray outward from the object's position along an axis (x/y/z), then back at the object and get the difference. This allows me to get the dimensions of an object in like 6 rays which is sufficiently performant.
But because castRenderingRay doesn't have the ignore param, It would not be easy to know where to start your measurement from, especially if there's a lot of rendered objects near the object you're trying to measure. Currently there isn't a good way to do it because of limitations with the released Lua API, unless you're willing to teleport the item away for 1 frame into a secluded space, measure it, store the measurements in lua storage, and then teleport it back LOL.
Considering that this mod doesn't allow players to push items through walls, and also involves applying gravity to items, if you want to incorporate PP into this mod (as opposed to just PP on its own) it will mean that this problem needs to be resolved first, or a compromise / alternative "item-placing-mode" is implemented instead.
- The item will rotate to follow the surface. This is toggleable with a key, and the default mode can be set in mod options. Special thanks to Merlord for this feature. The challenging part of this is defining what a surface is. Walls are fine, but shelves will be tricky because the collision box of shelves may just be 1 big box without factoring in the space in-between (unless castRenderingRay factors that in). Although since this is toggleable by a key and items can probably clip through stuff I suppose it's not too challenging (didn't investigate this deeply enough but if you want to allow this but may have to be willing to accept that you can clip items through walls / floor).
- Items in Vertical Mode can be mounted to walls just by placing them against a wall. Items don't experience gravity so you can even make items levitate in the air if you want.
- Rotation Snap lets you line up books precisely. This will be quite challenging. Easier to just use copy last rotation instead.
- Copy Last Rotation causes the held item to match the rotation of the last item you placed. Quite easy to do, yeah.
- Carry your stuff around anywhere, but you will drop it if you have to ready your weapons or magic! This is possible by checking player stance if i'm not mistaken.
Including it in this mod: Seems like a lot of work that I'm too lazy to do lmao but I can probably implement a "budget Perfect Placement" version LOL but it wouldn't have the same experience as PP haha: - Additional Grab Button that allows player to pick-up items without magicka. It will the items will clip through solid objects and don't experience gravity on release. - Implement a rotation mechanism of some sort
18 comments
I was wondering, could some of the logic used here be made to make a bomberman and rag n'wahs inspirered openmw alternatives?
Those are two really fun mods sadly restricted to MGE EXE
sorry if the writing is bad... I'm using the translator
I will add you to the description of my mod, and link here.
There's any chance of making it possible to manipulate objects like in Perfect Placement (this mod: https://www.nexusmods.com/morrowind/mods/46562)?
Like, just moving them without them rotating
Or that would be impossible in openmw? (I have zero knowledge about scripting)
- Perfect Placement places the item exactly on top of surfaces in horizontal mode, and the back of the item against vertical surfaces while in vertical mode.
If you allow objects to clip through other objects (so long as the player can position the items properly) then this is simple. But if you really want the "magnet" effect of it sticking to the surface that will be very tricky.
To me this is the trickiest part because this surface also factors in other items. For collision detection you can use Nearby.castRay lua API for actors and NPCs, but it doesn't work for items; the ray just doesn't detect items and goes through them. For Perfect Placement (PP) it's gotta be perfect so you'll have to rely on castRenderingRay. However, this API endpoint doesn't accept the ignore object parameter, so it is very easy for the ray to collide with, say, the object you're trying to move.
This can potentially be dealt with by computing the bounding box of the object before moving it. For context, the OpenMW lua API currently doesn't provide a way to get the bounding box, but the castRay & castRenderingRay APIs do factor it in when considering collision. So how I get the bounding box for actors/NPCs in this mod is I cast a ray outward from the object's position along an axis (x/y/z), then back at the object and get the difference. This allows me to get the dimensions of an object in like 6 rays which is sufficiently performant.
But because castRenderingRay doesn't have the ignore param, It would not be easy to know where to start your measurement from, especially if there's a lot of rendered objects near the object you're trying to measure. Currently there isn't a good way to do it because of limitations with the released Lua API, unless you're willing to teleport the item away for 1 frame into a secluded space, measure it, store the measurements in lua storage, and then teleport it back LOL.
Considering that this mod doesn't allow players to push items through walls, and also involves applying gravity to items, if you want to incorporate PP into this mod (as opposed to just PP on its own) it will mean that this problem needs to be resolved first, or a compromise / alternative "item-placing-mode" is implemented instead.
- The item will rotate to follow the surface. This is toggleable with a key, and the default mode can be set in mod options. Special thanks to Merlord for this feature.
The challenging part of this is defining what a surface is. Walls are fine, but shelves will be tricky because the collision box of shelves may just be 1 big box without factoring in the space in-between (unless castRenderingRay factors that in). Although since this is toggleable by a key and items can probably clip through stuff I suppose it's not too challenging (didn't investigate this deeply enough but if you want to allow this but may have to be willing to accept that you can clip items through walls / floor).
- Items in Vertical Mode can be mounted to walls just by placing them against a wall.
Items don't experience gravity so you can even make items levitate in the air if you want.
- Rotation Snap lets you line up books precisely.
This will be quite challenging. Easier to just use copy last rotation instead.
- Copy Last Rotation causes the held item to match the rotation of the last item you placed.
Quite easy to do, yeah.
- Carry your stuff around anywhere, but you will drop it if you have to ready your weapons or magic!
This is possible by checking player stance if i'm not mistaken.
Including it in this mod:
Seems like a lot of work that I'm too lazy to do lmao but I can probably implement a "budget Perfect Placement" version LOL but it wouldn't have the same experience as PP haha:
- Additional Grab Button that allows player to pick-up items without magicka. It will the items will clip through solid objects and don't experience gravity on release.
- Implement a rotation mechanism of some sort