Jump to content



Recommended Posts

The reason I'm posting here rather than there is that things have changed, I will release a Resource but it will be a work in progress where I need and would appreciate feedback along the way.

What does it do?
Say you want to have a chair move across a room as if controlled by a ghost. When the player opens the door, the chair moves in their sight - so they don't miss seeing it. What is going to move the chair?..

The function to do this is often referred to as a LERP, short for Linear IntERPolation.

Having done the core functions I have a template where you...

* Copy/Paste to new script and rename
* Rename all MyObjectRef with the name of the object
* Rename all MyXMarker with the name of the Destination XMarker

...save and test.
I need to provide tuition that expands on how this works.

The next template is for Looping Multiple Destination such as a model train track which is where things get a bit more complex. The distance between each Destination varies but we want the train to travel at a constant Rate - this needs to be explained through comprehensive tutorials.

Where OBSE Linear Algebra could be used I found it defeatest - correct me if I'm wrong.

Where a dll could wrap OBSE array with Vector based functions I think that would be more complex - correct me if I'm wrong.

In short, any help in getting this off the ground would be greatly appreciated, especially in making it usable.

Link to comment
Share on other sites

All CS/Oblivion (except for the other video which is part of my Unity game).


I've since refactored the code to only require the position and rotation functions. These perform the same as Vector3.Lerp in Unity.

I'm not planning to do Quaternion.Lerp at this stage as I don't see a need for it.


As I posted, the next step is to have CS scripts loop through an array of positions. If I get this right, there will be 2 scripts that you Copy/Paste/Massage.


The first script you copy/paste, rename and add the name of your xmarkers.

The second you rename the script the rename the call to the first script.


At this stage it is a thought experiment, same as the first. Having typed some pseudo code in Notepad++ I wrote the functions. The 2 errors were where I did not set 2 arrays but then it ran.

Link to comment
Share on other sites

The main advantage of this over Nif animations is that the Start and End can be anywhere, for example...

  • The Player enters a round room through any one of 12 doors.
  • A zombie head flies off a table across the room while screaming.
  • The head stares at the Player for a few seconds then drops to the ground.

The problem with this example is that working out the End involves using trigonometry based on Player Position and Rotation.


This is the sort of thing eating up my time on this. My aim is to provide this as a resource that requires minimal programming knowledge where you copy over the core scripts then Copy/Paste/Massage the scripts that you require. To provide step by step hands on tutorials.


To be honest, an amount of it should be written as an OBSE plugin but I'm a bit lost and don't know who to ask for help.

Link to comment
Share on other sites

I think this sounds really cool and I for one would love a ready resource to do this kind of thing but I'm afraid my scripting knowledge doesn't extend this far. Try making a post in the General Mod Author Discussion forums, I'm sure there are people there that can help.

Link to comment
Share on other sites

Having considered things, I won't factor code out to an OBSE plugin. The resource will require you to copy the core scripts over to your own mod. Anybody can alter them to suit their own mod this way.


Using the LERP functions I've written to animate an object from Start to End is fairly simple. I will provide a hands on tutorial, followed by a multiple choice exam. followed by DIY scripts.


There will be several more tutorials for looping the animation and multiple destinations.


The zombie head example in my previous post has problems...

Assuming the head looks along it's Local Y axis, same as Player, it should be 180 degrees opposite Player, right?

Wrong, the Player could walk into the trigger at almost -+ 90 degrees relative to the head.


The tutorials will step through to this using hands on exercises with 'known steps for known outcomes', followed by multiple choice exams, followed by DIY scripts to test you knowledge.


Considering that anyone could still have trouble with this I am planning a further solution. A desktop app to write the scripts for you.

Link to comment
Share on other sites

Linear Interpolation, now that's a blast from the past. It reminds me of how I always reinvented the wheel with a new vector math and lerp framework myself in every mod of mine having such effects.


My gliding flight approach was probably the most sophisticated making use of it. My ridable creature dragon, with ability to "turn into it" by going invisible, mounting a spawned creature and interpolating its turning movements towards the viewing direction, used it, too. And if I'm not completely mistaken (it's been too many years since) the simple functioning compass script I did for Room207 used some iteration of it as well, so no matter how flipped around the compass is the needle always points as north as it can go on the dial.


I may not be able to make any use of something like this myself, unless my free time surprisingly increases manyfold out of the blue one day, but it will definitely be useful to others having ready-made functions at hand like this. One of the most difficult parts to me always was the migration from real-world geometry concepts to the warped in-game replication of it (coordinate systems in game are completely different to what studies teach), re-writing all known quaternions and other matrices so they work with OBSE arrays and modified coordinates. Having to re-do it all the right way again and again with every new mod really was a taxing job. Something like this as a resource will definitely save a lot of time.


I for one was always having a huge lot of fun with these. This kind of math was always my strong suit. Thank you for the memory flash!

Link to comment
Share on other sites

So what is it you really need help with? The math or the chair? Id it is the object, as statics do not move around so well, could be made into and clutter or rather misc item and you could just copy it into a havoc mesh, with all visual NiTrixxxx stuff deleted (Remove Branch) in Nifskope. Copy the chair Nitrixxx branch to the new collision mesh, using 2 Nifskope windows. Just open Nifskope and press Ctrl-N and you get 2 windows. I guess maybe you knew this already, but I still mention it as that would be a nice object that could move easy, maybe even so the collision follows it. A ground Shield mesh could also work as a base mesh and it is not to hard to extend or move some vertices in the collision so it covers the whole chair, well some in z at least. Then the chair can move easy in all angles, using gravity, well havoc if the player bounces into it. You could even have a invisible ghost, bouncing into it, making it move natural that way. Just an idea. Maybe with a package that tells the ghost to go to ChairRef, radius 0 for some time :D That could be cool. Its like when the player in Skyrim gets into the Abandoned house in Markath and Molag Bal throws objects around, like clutter. I sure got my eyes opened when i was in that room for the first time. :D It is the same effect as you wanna achieve I guess?


If this is a chair you think that would suit you and you do not know how to make it, I can give it a try for sure.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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