Moving a movable static

Post » Wed Feb 02, 2011 6:21 pm

Whats the best way to get a movable static to move seemlessly? I want a rock to move from markerA to markerB and back again in a continuous loop, and the only way I can seem to do it is to write aup a script that after 0.25 seconds, forces it to move to markerApoint1 (a midpoint for the transition), increment a counter, then move to markerB and reverse. It just seems glitchy and erratic this way.

Any ideas appreciated :)

Demeggy
User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Wed Feb 02, 2011 3:30 am

You could utilise the SetPos command perhaps? Use a timer that in very small increments move the object along a line towards its target, it would seem much more natural that way and you wont have to use intermediate markers. It would probably be a fairly complicated little script as I dont really know how you would describe the line between the two points, but http://cs.elderscrolls.com/constwiki/index.php/Rotating_an_object_around_another_object_with_a_script tutorial may help you get the basics down. I am currently using this script to spin an object around the player in Oblivion and it works really well.

Ill have a think about how the mathematics behind the problem might look...
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Wed Feb 02, 2011 7:24 am

OK, I really have no idea if this will work coz im pretty tired (just finished a night shift!) and I knocked this up in about 2 minutes, but something like this may be what you are looking for:???

scn MoveObjectScriptRef objectFloat x1Float y1Float z1Float x2Float y2Float z2Float diffxFloat diffyFloat diffzFloat objxFloat objyFloat objzShort doonceBegin GamemodeIf doonce == 0	Set object to [your items ref]	Set x1 to [begin marker].GetPos X	Set y1 ...etc	Set z1 ...etc	Set x2 to [end marker].GetPos X	Set y2....	Set z2.....	Set diffx to ( x2 - x1 )	Set diffy to ( y2 - y1 )	Set diffz....	object.MoveTo [begin marker] ;If its not there already!	Set objx to x1	Set objy to y1	Set objz to z1	Set doonce to 1	Return ;the returns only here to allow a frame for the object to move the first marker, not sure if it makes a difference but it cant hurtEndIfSet speed to ( GetSecondsPassed * 0.5 )  ;The 0.5 here you can change to whatever you want, the smaller it is the slower the object will travel, experiment with itSet objx to ( objx + ( diffx * speed ) ) ; Im not entirely sure the laws of BODMAS apply in GECK, if they dont then an intermediate stage with extra variables will be needed here, someone else may be able to help you with thatSet objy to ( objy + ( diffy * speed ) )Set objz ....object.SetPos X objxobject.SetPos Y objy;etc for zEnd


This will also require extra stuff to detect if the object has moved past the 2nd marker, then flip the equations to move it back the other way, but this is all I can manage atm lol. Alternatively you could do this with an animation but I know absolutely nothing about that at all.
User avatar
Tyler F
 
Posts: 3420
Joined: Mon Aug 27, 2007 8:07 pm

Post » Wed Feb 02, 2011 4:29 am

Duplicate thread at newvegasnexus contains the answer.
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am


Return to Fallout: New Vegas