Aller au contenu

Photo

A Quick Script for Rotating Placeables In An Endless Loop


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
seraphimsage

seraphimsage
  • Members
  • 104 messages
Rotating placeables in an endless loop

(If this has already been mentioned I apologize but I thought I'd bring it to light anyway)

After many attempts to find an alternative to using 3dsmax to create fully rotating objects, similar to those asteriods in MoB and/or the gem in SoZ, I've finally found a rough solution for my 'mage's school planetary orrery' which I plan to use in conjunction with the visual effects editor and placeable.2da for the last part of my Nihil Mod Trilogy.

The Basic Requirements are rather simple:
(1) First copy and save this script to your module
(2) Place this script onto the 'onHeartbeat' script section on a placeable you want rotating.
(3) (Crucial) Make sure the placeable's 'Static' variable is set to 'FALSE'
(4) Load up the module and watch the placeable slowly spin in space.

Uses:
Excellent for other-worldy locations and dreamscapes. Examples include, but not limited to, rotating spheres, houses, rocks, statues, gears, weapons etc.

Special Notes:
It is still a bit rough, but hopefully it helps all those out there who want placeables to rotate in space without having to resort to 3dsMax's obscure animation logic to do so. Note that to speed it up or slow it down you may have to get/set some local variables to keep track of it or set down the 360 to something like 90, but testing and adaptations will be needed no matter what path you take.


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "ginc_reflection"


//Important Requirements:
//
//Placeable must be set to non-static. It will not work otherwise, so make sure that 'Static' flag is set to false on the object.
//Must be placed on the object's onHeartbeat section, replacing anything there previously.
//
//Note: the more you add to the iNumInterpolationPoints value the smoother the transition, but boosting this
//too much may hurt performance.



void main()
{
    object oSelf = OBJECT_SELF;

     //Uses the 'ginc_reflection' script that already exists in the game
     //InterpolatedRotation(float fRotationDegrees, float fInterpolationTime, int iNumInterpolationPoints, object //oTarget=OBJECT_SELF);
         InterpolatedRotation(360.0f, 6.0f, 720, oSelf);
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Modifié par seraphimsage, 04 mars 2012 - 08:10 .


#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 603 messages
I haven't seen this before or the function. Thanks.

#3
kamal_

kamal_
  • Members
  • 5 261 messages
Interesting. I'm wondering how this can affect the walkmesh.

#4
seraphimsage

seraphimsage
  • Members
  • 104 messages
I'm not sure about walkmeshes, but it may alter dynamic collisions.

#5
kamal_

kamal_
  • Members
  • 5 261 messages

seraphimsage wrote...

I'm not sure about walkmeshes, but it may alter dynamic collisions.

exactly. (rotates placeable blocking player out of the way...)

#6
Dann-J

Dann-J
  • Members
  • 3 161 messages
I'll have to take a look at ginc_reflection and see what this function is actually doing (for my own curiosity). I'd imagine it's rapidly destroying and re-creating the placeable (slightly rotated), but I'm willing to be pleasantly surprised.

#7
Dann-J

Dann-J
  • Members
  • 3 161 messages
Well colour me tickled pink - serendipity was indeed pleasurable! That function uses a cunning little iterative loop that fires off several delayed SetFacing() functions. It's basically stop-motion animation for placeables.