Suspending an object in the air while alowing it to rotate freely

I am trying to make a turret, and i dont feel like using wheels.

I am thinking of something like this: make an object locked to a specific position while still alowing it to rotate. Id place a vector thrustor on the turret whose xyz inputs are wired to a beacon sensors world_xyz, the sensor wired to a target finder. That way the thruster will try to fly away, rotating the other side of the turret towards the target. I put the gun on the exact oposite side of the vector thrustor. This all depends on if i can lock an object to a specific position while alowing it to rotate. How could i do this?

Could try using the hoverball.

axis tool?

Only locks z, and i dont see how i can preserve freedom of rotation.

Cant pitch.

you could weld a small prop to the ground and get the prop you want to be rotate-able you’d put on the spot in the air you’d want. freeze it, and ballsocket it to the prop welded to the ground. unfreeze it and voila! I’m not completely sure if this’ll work though

Rigid ropes. Make a tripod with them.

Ballsockets.
http://www.garrysmod.org/img/?t=dll&id=107103 contains a STool to ballsocket the centre of props to provide better movement.

This works the best ^

You could put a hover ball on the bottom and thrusters on the sides to rotate it.

obligatory reference to applyForce, possibly in combination with either applyAngForce or applyTorque

Dunno expression 2 yet.

I did found a way, sort of. I ballsocketed two boxes together and noclipped both. I also disabled gravity. The vector thruster, however, refused to obey. I had the beacon sensor set to output world xyz, connect to target finder, the vector thrusters xyz to beacon sensors xyz output. I dunno what the thruster tried to fly to, but it was not the enemy.

A question: the vector thrustor will try to fly towards the coordinates that it is inputed, right? So if the beacon sensor outputs world_xyz then the vector thrustor will fly to that, right? Or is it coords in relation to its current position, so that if the vector thrustor is inputed 0,0,0 it will fly to where it already is.

Edit:

Doesnt that restrict rotation? Or do you mean like, attach each rope to the same spot on the prop, but to different spots on the ground?

Get the BallSocket center from wenlis tools (Posted above here)
Uncheck free movement and allow you rotation, Click prop and world and you are done

The vector thrusters fly based on its current position but a way to get it so it flies to a position is make a gps near it and subtract the position you want it to go to from the position where it is

VThruster—>Vector-WorldXYZ

I just found something. The vector thrustor can apply force against its local as well as global coordinates, with local being default. If you use world xyz for the thruster you wont even need the gps. I just built a working jet with it. You have to be mindfull of its orientation when using local coords, as its rotation affects its behaviour. Use rotation snap and weld to get it straight.

Here’s an E2 that will keep a prop in one location, while allowing it to spin freely:



# We need the chip to remember these values.
@persist Mass:number Base:entity Target:vector

# This block is only executed the first time the chip runs
if(first() | duped())
{
    # We'll set the base prop of the turret as whatever the
    # expression chip is placed on:
    Base = entity():isWeldedTo()


    # We need to find the mass of everything attached 
    # to the base prop, because we'll be using the total 
    # contraption mass in our applyForce function
    
    # First, we set variable Mass to the mass of the E2,
    # because getConstraints doesn't include the chip itself
    Mass = entity():mass()

    # We set Props as an array of everything that is attached
    # to our base prop, and run a For loop to add up every prop's 
    # mass
    Props = entity():getConstraints()
    for(Index = 1, Props:count())
    {
        Mass += Props[Index,entity]:mass()
    }

    # We need to set a Target vector for our base to hover at.
    # As written, the target is 100 units above where the base
    # starts at.  Change this to wherever you need it to be.
    Target = Base:pos() + vec(0,0,100)
}

# That's the end of the first() block.  We will use runOnTick to 
# cause the chip to continually execute everything from here on.
runOnTick(1)

# We've already set the Target, but we also need the base's
# current position.
CurPos = Base:pos()

# We've got our target, our current position, and the mass of what
# we're moving, so we're ready to applyForce.

Base:applyForce(((Target-CurPos)-Base:vel())*Mass)

# Target - CurPos gives us the difference between where we are and
# where we want to go.  -Base:vel() makes the ride much smoother,
# and we scale the amount of force by the mass that we want to
# move.


Without the comments:



@persist Mass:number Base:entity Target:vector

if(first() | duped())
{
    Base = entity():isWeldedTo()
    Mass = entity():mass()
    Props = entity():getConstraints()
    for(Index = 1, Props:count())
    {
        Mass += Props[Index,entity]:mass()
    }

    Target = Base:pos() + vec(0,0,100)
}

runOnTick(1)
CurPos = Base:pos()
Base:applyForce(((Target-CurPos)-Base:vel())*Mass)


If I’ve inadvertently missed something important, feel free to correct me.

Yeah, this doesnt help too much. I dont understand a word of E2, so i wouldnt know why it works. Knowing how to is not the same as knowing why.

You’ll never figure it out if you never try. At the very least, copy this down somewhere and take another look at it when you’re ready to.

I am trying, but its better that by learning e2 i figure out myself how i can achieve the desired effect, rather than having the answer handed to me. And yes, i will type it down.