Jump to content

Is there something like OnTriggerEnter but for physical collisions (walking, not weapons)?


Recommended Posts

In my mod Liminal Portals (https://www.nexusmods.com/skyrimspecialedition/mods/104212), you need to approach the portal and activate it in order to be teleported. I would like to add a feature that teleports you just by walking into the portal, but that has been a challenge.

 

Because the portals are created dynamically by spell scripts, I can't place trigger boxes in the creation kit to use the OnTriggerEnter function. I had looked into using the spawnable trigger boxes mod, but it is incredibly difficult to get such a specific size (I need players to still be able to get close enough to interact with the portal to use other features besides teleporting). It is made even more difficult because the vanilla model it's based on actually has the "center" a fair bit in front of the portal.

 

If at all possible, it would be great to just detect when a player physically bumps into the portal and trigger the teleport script that way, but I can't find anything that would do that. So as a last ditch effort I'm asking here: is there any way for me to detect walking collisions with a specific object?

Link to comment
Share on other sites

Sounds like are you are describing exactly what many doors do. Like the "door" at a cave entrance where you simply walk until you enter the cave. Basically take one of those and add a portal visual

Link to comment
Share on other sites

1 hour ago, xkkmEl said:

There is the "isSmallBump" condition... but the documentation is scant and I have never used it except in actor-actor collisions.

Thank you for that, I was not aware of that condition. You weren't kidding about the lack of documentation. I'm not sure I'll be able to use it on dynamically placed objects but it's a lead worth investigating.

16 minutes ago, Sphered said:

Sounds like are you are describing exactly what many doors do. Like the "door" at a cave entrance where you simply walk until you enter the cave. Basically take one of those and add a portal visual

I looked into that, but unfortunately it's more complex. Because the portals are created dynamically by script from a single base portal, I can't just create normal doorways.

Link to comment
Share on other sites

I use isSmallBump too and has name implies it is NPC bumping into another NPC, causing a slight stagger, but for me it only triggers at a reasonable speed hip and shoulder that needly knocks them to them ground, without being an attack of any sort.

"Hey watch it" or "You, be careful"

don't waste your time on it

Link to comment
Share on other sites

56 minutes ago, PeterMartyr said:

I use isSmallBump too and has name implies it is NPC bumping into another NPC, causing a slight stagger, but for me it only triggers at a reasonable speed hip and shoulder that needly knocks them to them ground, without being an attack of any sort.

"Hey watch it" or "You, be careful"

don't waste your time on it

That is unfortunate, but thank you for the info.

Link to comment
Share on other sites

Would not placing the other trigger box in relation to the portal simply be be a Math Cos and Sin problem? Get the location of the portal and Math the shite out it for  placement, like Matt Damon in the Martin

Oh you may need to make the trigger box place it holding cell and move it too, untested but an idea

Link to comment
Share on other sites

Seems that the spawnable trigger boxes mod is going to be the only way. So far I have been unable to get the size and position right, but in theory it should work. It is just very difficult.

  1. Resizing the trigger boxes is a bit challenging and requires multiple steps (which fortunately are documented well). However, the portals in my mod can been resized, so I need a size that matches the portal perfectly so that small differences don't get scaled into large differences. Since you can't actually see the trigger box, it's really hard to test such precision.
  2. Once the size works, I need calculate where to place it, again considering the size of the portal. Because the portal mesh has a "center" in front of the portal, larger portals are farther from the center than smaller portals, so the math will need to account for the scale.
  3. Then I need to make sure the scripting all works. Each portal needs to keep track of the attached trigger box so that the box is removed if the portal is removed. Likewise the trigger box needs to know which portal to trigger.

It's just really hard, and would be a lot easier if I could do "OnActorBumpIntoObject" or something.

 

I could also try to combine the spawnable trigger box mesh and portal mesh into a single mesh. I tried that and was able to get the proof of concept to work, but then I could not resize the trigger box and again ran into the issue where the portal "center" is not actually the visible portal, so it was triggering when the portal was quite far away.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...