Jump to content

Moving and rotating "connected" parts


Recommended Posts

Good morning everybody!

 

I am currently working on something that contains a moving platform.

The platform should be able to move up and down. Nothing complicated.

 

I want to make it look like it is using a "scissor mechanism" to move up and down.

(https://en.wikipedia.org/wiki/Scissors_mechanism)

 

I got a script to work that moves the individual parts.

I can set the height that the platform should move to with a property of the script.

 

Here is the script:

Scriptname GI_BPC_TLS_Lift_Script extends ObjectReference
{Controls the Torpedo Loading System Lift}

Float Property H Auto
{Height to lift to}

Float Property MovSpeed Auto
{Movement Speed}

ObjectReference Property BeamA Auto
{Beam A}

ObjectReference Property BeamB Auto
{Beam B}

ObjectReference Property BeamC Auto
{Beam C}

ObjectReference Property BeamD Auto
{Beam D}

Float Property L Auto
{Length of each beam}


Event OnActivate(ObjectReference akActionRef)
;button was pushed
	
float XA = BeamA.GetPositionX()
float YA = BeamA.GetPositionY()
float ZA = BeamA.GetPositionZ()

float RotXA = BeamA.GetAngleX()
float RotYA = BeamA.GetAngleY()
float RotZA = BeamA.GetAngleZ()

float RotXB = BeamB.GetAngleX()
float RotYB = BeamB.GetAngleY()
float RotZB = BeamB.GetAngleZ()

float RotXC = BeamC.GetAngleX()
float RotYC = BeamC.GetAngleY()
float RotZC = BeamC.GetAngleZ()

float RotXD = BeamD.GetAngleX()
float RotYD = BeamD.GetAngleY()
float RotZD = BeamD.GetAngleZ()

float XB
float YB
float ZB

float XC
float YC
float ZC

float XD
float YD
float ZD

float XE
float YE
float ZE

float XF
float YF
float ZF

float XV
float YV
float ZV

float XW
float YW
float ZW

float D

float alpha

; calculate D and alpha

D = math.sqrt((L*L)-((H/2)*(H/2)))

alpha = math.acos((H/2)/D)



; asign the values to the variables

YB = YA - D
ZB = ZA
XB = XA

YC = YA
ZC = ZA + (H/2)
XC = XA

YD = YA - D
ZD = ZA + (H/2)
XD = XA

YE = YA
ZE = ZA + H
XE = XA

YF = XA - D
ZF = ZA + H
XF = XA

YV = YA - (D/2)
ZV = ZA + ((H/4)*3)
XV =  XA

YW = YA - (D/2)
ZW = ZA + (H/2)
XW = XA

RotXA = (90.0 - alpha)

RotXB = (180.0 + alpha + 90.0)

RotXC = (90.0 - alpha)

RotXD = (180.0 + alpha + 90.0)


; move and rotate everything

BeamA.SetMotionType(BeamA.Motion_Keyframed)
BeamB.SetMotionType(BeamB.Motion_Keyframed)
BeamC.SetMotionType(BeamC.Motion_Keyframed)
BeamD.SetMotionType(BeamD.Motion_Keyframed)

BeamA.TranslateTo(XA,YA,ZA,RotXA,RotYA,RotZA,MovSpeed)
BeamB.TranslateTo(XB,YB,ZB,RotXB,RotYB,RotZB,MovSpeed)
BeamC.TranslateTo(XC,YC,ZC,RotXC,RotYC,RotZC,MovSpeed)
BeamD.TranslateTo(XD,YD,ZD,RotXD,RotYD,RotZD,MovSpeed)	

EndEvent

The variable XA describes the X position of the point A (or the beam A).

The origin points of the beams are marked with the coloured points in the sketch.

73722383-1640404771.png

 

 

 

The problem is that when I set all the parts to move with the same movement speed, they don't look like they are actually connected, some parts move slower some move faster.

 

 

Is there a way to attach one static object to another (at a specified point)?

So that when the one object moves, the other one moves too, but can still rotate freely.

 

 

 

 

No, I don't want to use animations for this, I want to do this just with a script because there will be 5 different heights that this platform should be able to move to.

 

 

Now, you might ask "why do you want to use such a difficult to implement movement mechanism?"

Because this is a very compact way of moving heavy things up and down.

And let's just say that there isn't much space where I intend to use this ...

Link to comment
Share on other sites

Nice math. I do like you idea. Personally, i think an animated 3d model would be a better choice here, but even a 3d model would be a bit complex. However, I think it could be designed to raise/lower to the five height points and then these could be played via a script. Alternatively, a hydraulic lift (like the type used in auto repair shops) would also work, is realistic and used to lift heavy objects, and it is no where near as complicated to set up.

Edited by pepperman35
Link to comment
Share on other sites

Actually the math is very simple.

It is just pythagoras to figure out the lenght of "D" and then just arccos to get the angle.

And all the angles are the same (+-90 or 180 or whatever degrees because they are "mirrored").

 

 

And yes, I know.

A simple hydraulic cylinder lift would be "easier".

 

But that would take up more space "below" the lowest point of this lift.

And there is (almost) no space there.

(I mean, there is space there but that is taken up by something else, and you can't have hydraulic cylinders sticking into that space)

 

Yes, I know that there are telescoping hydraulic cylinders where you have a cylinder within a cylinder so the room it takes up in the "not extended configuration" is minimized, but still, it would require a meter or more of space below the "floor", and that just won't work.

 

Using "ropes" (splines) that would lower the platform from the "ceiling" with like a crane would also not work, because there is very little room above as well.

And there is also already something that takes up space directly under the ceiling.

And in terms of "realism": quickly moving something heavy with ropes is not a good idea

 

I spent a lot of time thinking about different methods and finally came to the conclusion that this is the only way to do this.

 

 

Yes, keeping things realistic is fun (for me)!

 

 

(Yes, I know, this is just modding, but I just LOVE technical details like this and "designing" things like this as if they were real projects)

Link to comment
Share on other sites

I don't think this will ever work smoothly, because of the script induced lag in animating with translateto().

You can see this even with the vanilla water treatment plant quest, where all the individually animated water planes often don't move in sync (for which a much better solution would be to move just one plane and refattach the other planes to that. but refattach is so buggy that it means opening yet another can of worms.)

Link to comment
Share on other sites

What about an above ground hoist?

 

Also, I do tree work occasionally, and we regularly move multi-ton chunks with ropes. Granted, they are some pretty substantial ropes. :D

About the "above ground hoise":

 

That might work, give me a few hours, I need to actually draw it up in 3d to say if it will fit or not.

Because the problem is that the "lift platform" should also be able to move "left and right", with the scissor lift I planned on just moving the whole lift (the base of the lift).

With this approach I would either have to move just the platform or the "posts".

Both approaches are difficult, because in my case there is less room the higher you go.

 

About the "moving stuff with ropes":

 

Sure, it is possible, but quick and very precise movements are very difficult to do (reliably) with ropes.

And like I said, this thing should be able to move up to the "ceiling" and there is no space for a crane-type of setup there.

 

(I am talking about "only" 2 metric tons)

 

(I am not trying to "recreate" something, something like this does not exist IRL to my knowledge, but if it did I would probably don't know about it anyway)

 

 

(You probably wonder what weird "environment" this setup is supposed to fit into.)

Edited by YouDoNotKnowMyName
Link to comment
Share on other sites

Sooo, here is a quick sketch of what the "restrictions" of space are like':

 

73722383-1640627974.png

 

Only a cylinder - shaped volume can be used for stuff, everything red is space that is already taken up by other stuff.

 

As you can see, "crane & ropes above" does not work.

The platform needs to be able to be moved left & right, except when it is at the top, then it just needs to be in the center.

The green "inverted T shape" thing is the volume in which the platform should be able to move.

 

I hope this helps you understand the spacial restrictions that I am trying to work around.

Link to comment
Share on other sites

it is probably worth making full-fledged animations of all the necessary sequences. The implementation can be viewed in the "glass elevator institute" mod, where 5 floors are implemented (I don't remember exactly) in 10 sequences. There is no fundamental difference in the movement of the platform in space. It's just a matter of working with the animation of the model. Work with a 3D object in max. Edited by South8028
Link to comment
Share on other sites

it is probably worth making full-fledged animations of all the necessary sequences. The implementation can be viewed in the "glass elevator institute" mod, where 5 floors are implemented (I don't remember exactly) in 10 sequences. There is no fundamental difference in the movement of the platform in space. It's just a matter of working with the animation of the model. Work with a 3D object in max.

I guess I am going to have to learn how to do animations in 3ds max ...

 

Is there a tutorial for creating nifs with different animations in one nif file?

(So I could have a "go from position 1 to position 2", "go from position 2 to position 1", "go from position 2 to position 3", "go from position 3 to position 2", ..... all in one nif file, and play the animations with a script)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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