Jump to content

[LE] Moving Objects Collisions (TranslateTo & other methods)


Recommended Posts

As the title indicates, I am looking for a way to have objects moved with the TranslateTo function collide, either with terrain, or with a custom collision pane/triggerbox.

 

TranslateTo removes collisions, but when the nif of the moved object is assigned the right flags the object does collide with the player/actors, however with nothing else. Do you know of a workaround which does allow it to collide with other things?

 

One option I looked into was assigning a custom collision layer to the collision panes (the SKY_L types) to get it to use the actor collision layer, but either I am not using the right one or this method does not work.

 

An alternative was to use the GetVATS functions to calculate distance between the object and its suroundings, but this too does not seem to work as intended, I suspect that this is because the GetVATS functions are only used on CameraPaths.

 

Any help would be appreciated

Edited by theblackpixel
Link to comment
Share on other sites

In order to use any 'Translate' function to move an object with its collision, you need to do the following:

* This does not applies for actors.


1) If the mesh is from the vanilla game extract it from the BSA.


2) Open the nif in NifSkope and assign the following:

- bhkCollisionObject > bhkRigidBodyT

Havok Col Filter = ANIMASTATIC

Havok Col Filter Copy = ANIMASTATIC

Motion System = MO_SYS_BOX

Deactivator Type = DEACTIVATION_NEVER

Solver Deactivation = SOLVER_DEACTIVATION_OFF

Quality Type = MO_QUAL_INVALID


3) Insert into CK the nif as a new 'Movable Static' object, now the object will move alongside its collision when used with any 'Translate' function.

Edited by maxarturo
Link to comment
Share on other sites

You can't exclude collision from not colliding with an object, it will with all.

That being said, when an object's collision is been translated, the collision will pass through all objects ignoring other objects collision.


Explaining with simple words your idea may help others provide you with a suitable solution for what you are trying to accomplish.

Link to comment
Share on other sites

 

You can't exclude collision from not colliding with an object, it will with all.
That being said, when an object's collision is been translated, the collision will pass through all objects ignoring other objects collision.
Explaining with simple words your idea may help others provide you with a suitable solution for what you are trying to accomplish.

 

Ok, so put simply: I want to translate a ship, but want it to collide with its environment. It's a controlled environment, so placing markers around where I want the ship to collide is possible if necessary. As you mentioned the collision passes through other objects, all but the player. This gave me the idea to create a collision pane using the same collision layer as the player, but that did not work.

 

I have a new idea which I have yet to implement:

 

Cast an invisible magelight at certain intervals, then use GetDistance to calculate the distance between the magelight and the ship, as the magelight will stop at any object. Then, just before the next magelight is cast, remove the old one. Essentially my idea works like a Skyrim version of a radar. When the distance between the ship and the magelight is below a certain number I would then stop the translation and add some effects indicating a collision. Since I have yet to implement this I don't know what the impact on performance would be though, and how exactly I'll get the timing to be perfect, since both the ship and the magelight are moving.

Edited by theblackpixel
Link to comment
Share on other sites

Simplify your idea's execution.

I'll just suggest how 'I' would do it.


Since we are talking about a controlled scene things are much more easy to implement (but not to execute). My general idea is to create a scene where everything will be controlled by a 'Master Controller', a master script that will be handling everything in a pre-defined controlled sequence.


The only issue you may encounter during its creation is the correct timing between each "ship crush", which is not actually an issue, but the actual work that it needs to be done.


You will need to use only the 'translate', 'wait()' and the 'Game.ShakeCamera()' function to work together.


Here is my script example that I'll be using the 'TranslateToRef()' function:



EVENT Some Event...
Ship.TranslateToRef()
Utility.Wait() ;Wait the precise time needed to reach the crash site
;Now play the virtual scene to simulate the virtual ship crash
CrashSoundFX.Play()
Game.ShakeCamera()
VisualFX.Play()

;;;; Repeat the sequence for the required length of the journey
ENDEVENT



Now, you will probably say, this timing thing is too much trouble and work.

Unfortunately you can't do everything in this game and engine, and you need to resort to such solutions, plus, is the most cheapest and reliable solution for such a scene.


* You should see how much timing I had to do for some of my scenes in my ACT II quest mod to achieve things that just can't be done and/or are not supported in this game using the default tools, I was literally working with a timer in hands.

Edited by maxarturo
Link to comment
Share on other sites

 

Simplify your idea's execution.
I'll just suggest how 'I' would do it.
Since we are talking about a controlled scene things are much more easy to implement (but not to execute). My general idea is to create a scene where everything will be controlled by a 'Master Controller', a master script that will be handling everything in a pre-defined controlled sequence.
The only issue you may encounter during its creation is the correct timing between each "ship crush", which is not actually an issue, but the actual work that it needs to be done.
You will need to use only the 'translate', 'wait()' and the 'Game.ShakeCamera()' function to work together.
Here is my script example that I'll be using the 'TranslateToRef()' function:
EVENT Some Event...
       Ship.TranslateToRef()
       Utility.Wait() ;Wait the precise time needed to reach the crash site
                      ;Now play the virtual scene to simulate the virtual ship crash
       CrashSoundFX.Play()
       Game.ShakeCamera()
       VisualFX.Play()
 
         ;;;; Repeat the sequence for the required length of the journey
ENDEVENT
Now, you will probably say, this timing thing is too much trouble and work.
Unfortunately you can't do everything in this game and engine, and you need to resort to such solutions, plus, is the most cheapest and reliable solution for such a scene.
* You should see how much timing I had to do for some of my scenes in my ACT II quest mod to achieve things that just can't be done and/or are not supported in this game using the default tools, I was literally working with a timer in hands.

 

Ah, it seems I did not illustrate my goal clearly enough, or I misunderstand your solution. I should clarify: We are not talking about a pre-defined collision here. Essentially the player is able to control the nif/ship manually, which works through the TranslateTo function. They can hit anything at any time. It is only a controlled environment in the sense that this is not in the Skyrim worldspace, and there will be no option to traverse that worldspace with anything other than that ship.

 

I'd also like to extend my thanks for your help, not just on here, but on Nexusmods in general, I see how often you reply to people's questions, you've become quite the pillar of the community, I and others greatly appreciate what you do. I hope you become a Nexusmods Community manager one day (if that would interest you), you are one in all but name.

Link to comment
Share on other sites

I don't think you would need a magelight. Just place some xmarkers and calculate the distance between that and some marker or other object on the prow of your ship. You might have to have a check for direction as well so passing beside something wouldn't trigger a collision.

 

Or could you use trigger boxes and OnTriggerEnter to check for collisions? That might also catch side swipes.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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