Orbiting Platform

I have been trying to make a platform that will orbit a certain area or planet on a spacebuild map and not leave that orbiting zone, but I cant figure it out. Could someone help me with this and tell me how?

Well, making it orbit the planet itself isn’t easy since that’s a part of the world. But you could make an E2 (wiremod) that would orbit a prop, at a certain range and even at a certain angle, fairly easy :)…
Hope that’s a useful idea, gimme a holla if you need help with it

Or use the adv gyro, vector gates, gps, timer, trig, constant values ect.

Could you give me a bit more of a description cause all I really know is the absolute basics of wire and I am starting to learn more by watching tutorial and getting people in game to teach me but there are no tutorials on this that I can find

Hey there! sorry watched mythbusters… Anyhow!, i made this for you,

@name Orbitter
@inputs Planet:entity Sat:entity
@persist PPos:vector SPos:vector Head:angle Dist 
@persist OrbitDist OrbitVel

OrbitDist=50# Orbit Distance
OrbitVel=1# Orbit velocity

Dist=SPos:distance(PPos)# get's the distance from the satellite to the planet
Head=Sat:heading(PPos)# get's the angles relative to the planet

PPos=Planet:pos()# Planets XYZ position
SPos=Sat:pos()# Satelites XYZ position

Sat:applyAngForce(-Head-$Head)# This makes the satellite face the planet

# The "(vec(0,0,9.015))" part is only there to make the satellite defy gravity, since i tested this by making a box orbit a ball in a normal map :p

That will make the “Satellite” orbit the “planet”, both being props, at X range, at X Velocity…

This of course is just whipped together so there’s a few kinks, f.ex the roll of the sattelite isn’t being handled at all so if it’s hit by something and starts rolling, it’ll keep doing so and might just go in a little circle at X range from the planet instead of a full orbit…

Anyhow!, primarily made this so you could learn from it, not for perfection so if you have any questions, ask away.

Ugly code.

@name Orbit
@inputs Planet:entity TarPos:vector #Entity marker this, marker linked to its self. Or a gps
@persist TargetPos:vector TargetAngle:angle Radius E:entity
if (first() | dupefinished()) {
    TargetPos = vec()
    Radius = 500 #radius
    Speed = 50 #speed
    E = entity()
if (Planet) {TargetPos = Planet:pos()}
if (TarPos) {TargetPos = TarPos}
Offset = vec(Radius,0,0):rotate(ang(0,curtime()*Speed,0))
E:applyForce(( (TargetPos+Offset-E:pos())*20 - E:vel())*E:mass())

Torque = E:toLocal(rotationVector(quat((TargetPos-E:pos()):toAngle())/quat(E))+E:pos())

I don’t go around around battering your pathetic attempts on spelling now do i? :slight_smile:
oh i guess i did.

Don’t worry mod’s,I won’t begin a flame war, this is my only post on the matter :stuck_out_tongue: just hate unjustified rudeness.

I’m saying the code is ugly, due to the fact you didn’t persist parts of the code which would be better persisted, and used the delta applyForce, which is less logical and less compatible. That is all.

either way thanks both of you, I will try both codes out when I get on later tonight

Your welcome :), hope i made it easy enough to understand

I tried both of your codes, but neither of them worked for me :l
Neotic’s chip did nothing and whosdr’s chip just floated next to the specified target and didn’t orbit. The code would be really helpful if it worked… Thanks

EDIT: I got the Neotic’s orbitter to work, but I still can’t seem to get the whosdr’s code to work >:l

Actually better idea, i forgot if e2 has a function to find entities, but all spacebuild planets have an entity in the center of them that tells the gamemode that there is a planet, i think that it is called:
the reason i append the * is because there are multiple variations or it, the * is a wildcard in e2, meaning it should detect any entity with base_sb_planet as the beginning sequence of characters for a name.

I’m sorry, but I can’t seem to get the point how does that help me…

Make an e2 that searches for an entity called base_sb_planet* in the map. Then make it orbit the closest one, rather than spawning a prop.

it should be easily adapted from his code, just replace where he references the prop.