Without spoiling a surprise, I'd like some help with writing some generic code for acquiring a vector, then moving a station, one pixel at a time, slowly, along that vector.
The idea is, the station slowly moves around the outside of a group of objects. I know stations can move, it's just that I'm, rather new to Transcendence coding, and need help with vectors, especially.
Thanks in advance, please only reply if truly interested in helping.
PK
Station Movement Help Wanted
- PKodon
- Militia Lieutenant
- Posts: 127
- Joined: Sat Apr 18, 2009 6:03 pm
- Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"
Just the man I was looking for, thanks for responding.
Out of curiosity, what command are you using to move the station?
I was thinking of using objMoveTo with a vector to get it under 1 ls.
Oh, and try doing the moving in an <onUpdate></onUpdate>
You know, I hang out on the IRC channel, if you want to discuss this in "real time".

PK
Out of curiosity, what command are you using to move the station?
I was thinking of using objMoveTo with a vector to get it under 1 ls.
Oh, and try doing the moving in an <onUpdate></onUpdate>
You know, I hang out on the IRC channel, if you want to discuss this in "real time".

PK
I haven't gotten very far, here's what I have: a function that moves an object a specified speed and direction
obj= the object
dir= direction
speed= the speed to move it
option= if 1 the object retains it's current momentum in addition to the new acceleration.
I don't know of a way to get less than 1ls resolution with anything, so objMoveTo for moving is out of the question, too choppy.
The code will work on a moveable station too, I tried it on my ship, a corsair, and a cargo crate, all of them moved but...
It seems objIncVel is broken in rc6, it only does high speed when used with sysVectorPolarOffset, in the code above with speed=1 I went light-speed, when it was less I went 0...
Somehow restoring the object's previous velocity vector works perfectly, so I could just be missing how to make a proper velocity vector.
Code: Select all
<globals>
(setq objSetVel (lambda (obj dir speed option)
(block (currVel)
(setq currVel (objGetVel obj))
(objMoveTo obj (objGetPos obj))
(if (eq 1 option)
(objIncVel obj currVel)
)
(objIncVel obj (sysVectorPolarOffset Nil dir speed))
)
))
</globals>
dir= direction
speed= the speed to move it
option= if 1 the object retains it's current momentum in addition to the new acceleration.
I don't know of a way to get less than 1ls resolution with anything, so objMoveTo for moving is out of the question, too choppy.
The code will work on a moveable station too, I tried it on my ship, a corsair, and a cargo crate, all of them moved but...
It seems objIncVel is broken in rc6, it only does high speed when used with sysVectorPolarOffset, in the code above with speed=1 I went light-speed, when it was less I went 0...
Somehow restoring the object's previous velocity vector works perfectly, so I could just be missing how to make a proper velocity vector.
- PKodon
- Militia Lieutenant
- Posts: 127
- Joined: Sat Apr 18, 2009 6:03 pm
- Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"
Okay, first off, supposedly, you can feed a vector to objMoveTo, which should mean that, if the vector is short enough, it should move one pixel.
Second, if the station has momentum, then a kinetic or blast weapon could move it out of it's planned course, and code would need to be included to bring it back on course.
Thus, I'm hoping to make the station not be mobile, normally, unless moved with objMoveTo.
I'll have to do some research on objMoveTo regarding the vector input, and get back to you.
The first step, I think, is to figure out how to set a waypoint, then move toward that waypoint along a short vector in the general direction of the waypoint.
PK
Second, if the station has momentum, then a kinetic or blast weapon could move it out of it's planned course, and code would need to be included to bring it back on course.
Thus, I'm hoping to make the station not be mobile, normally, unless moved with objMoveTo.
I'll have to do some research on objMoveTo regarding the vector input, and get back to you.
The first step, I think, is to figure out how to set a waypoint, then move toward that waypoint along a short vector in the general direction of the waypoint.
PK
Unless I'm very mistaken, such a function would take a position vector, which is an absolute position in space (usually relative to some permanent immobile object, in Source, more or less an arbitrary point in space. If I were making Transcendence I'd use the Sun) as opposed to a direction vector, which conveys velocity (direction of movement, i.e. 1,0 would move up the X axis, and speed as magnitude, like 4,1 would go up the X axis four units and the Y one every tick).PKodon wrote:Okay, first off, supposedly, you can feed a vector to objMoveTo, which should mean that, if the vector is short enough, it should move one pixel.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
I don't know if this will help you in your station moving problems but we got
(sysVectorPolarVelocity angle speed) -> velVector
in one of the RCs.
(sysVectorPolarVelocity angle speed) -> velVector
in one of the RCs.
Crying is not a proper retort!
That's it, thanks Betelgeuse.
here's a fully functional object moving global helper function.[/size]
The station being blown off course won't be so bad when the station stops itself over time anyway (unlike ships, which drift forever), particularly if the mass is high(which won't affect objIncVel) and since the function can also stop any drifting when it is called in the onUpdate (omit the "option" parameter).
I don't think "jumping" a smaller than 1ls, but non-zero distance is possible with objMoveTo, it will be very jerky.
here's a fully functional object moving global helper function.
Code: Select all
<globals>
(setq fnSetVel (lambda (obj dir speed option)
(block (currVel)
(setq currVel (objGetVel obj))
(objMoveTo obj (objGetPos obj))
(if (eq 1 option)
(objIncVel obj currVel)
)
(objIncVel obj (sysVectorPolarVelocity dir speed))
)
))
</globals>
The station being blown off course won't be so bad when the station stops itself over time anyway (unlike ships, which drift forever), particularly if the mass is high(which won't affect objIncVel) and since the function can also stop any drifting when it is called in the onUpdate (omit the "option" parameter).
I don't think "jumping" a smaller than 1ls, but non-zero distance is possible with objMoveTo, it will be very jerky.
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
I did some trials with objMoveTo in 0.99c, and you can actually get a pretty smooth animation going *until* you hit some heavy fighting or other cpu consuming task... then it looks horrible. The timer to move the station has to be run every tick, which is hardly recommended for any non critical task.
- PKodon
- Militia Lieutenant
- Posts: 127
- Joined: Sat Apr 18, 2009 6:03 pm
- Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"
alterecco,
How fast were you trying to move your space object? The targeted object in this case should only be moving one pixel every 30 ticks (1 second), as onUpdate runs once every 30 ticks (or so I understand it).
PK
How fast were you trying to move your space object? The targeted object in this case should only be moving one pixel every 30 ticks (1 second), as onUpdate runs once every 30 ticks (or so I understand it).
PK
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
Sorry, the code has been lost to the mists. It would not have served you anyways, since it did not do what you need (it was continuously placing a spaceobject relative to the playership... a futile attempt to make hud elements)