Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: getVelocity().set() speed capped  (Read 1941 times)

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
getVelocity().set() speed capped
« on: December 18, 2013, 06:32:16 PM »

getVelocity().set() is capped to 600 max speed(directionless)


picture of what should be a constantly accelerating asteroid using a beam effect
Spoiler
Code: java
                        Vector2f QVel = query.getVelocity();
                        engine.addFloatingText(QLoc, "Av-> "+QVel, 20f, Color.RED, beam.getSource(), 1f, .5f);
                        //towards line (not used)
                        Vector2f ToL = V2fPerpendicularDisc(dir, (Sadj < 100 ? Sadj : 100), (DtoL<0? 1:0));

                        //towards end (just adds 100 velocity each tick, 50 ticks/second)
                        Vector2f ToE = V2fReSize(dir, (Sadj < 100 ? Sadj : 100));

                        //adjust the velocity (velocity calculator)
                        Vector2f Qre = new Vector2f(QVel.getX()+ToE.getX()/*+ToL.getX()*/,
                                QVel.getY()+ToE.getY()/*+ToL.getY()*/);

                        //setting the velocity
                        QVel.set(Qre);

                        //also tested using
                        //QVel.set(QVel); //observed same 600 speed cap
[close]

screenshots using engine.addFloatingText to display actual object velocity vector
Spoiler

diagonal (works out to be 600speed)
[close]
« Last Edit: December 18, 2013, 06:42:01 PM by dmaiski »
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: getVelocity().set() speed capped
« Reply #1 on: December 18, 2013, 06:41:15 PM »

This is intentional. Most entities on the combat map have their speed clamped by the game engine, you'll notice the same thing if you try to give a ship a top speed of 1,000 su/second. I think only projectiles are exempt.
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: getVelocity().set() speed capped
« Reply #2 on: December 18, 2013, 06:43:07 PM »

this effects projectiles...

see railgun bullets and getVelocity().set() they have their speed clamped to 600 (i noticed this because it was clamping railgun shells at 1/2 speed)

readout for autocannon projectile (railgun projectile fires too much to be legible)
« Last Edit: December 18, 2013, 06:47:12 PM by dmaiski »
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: getVelocity().set() speed capped
« Reply #3 on: December 18, 2013, 10:30:21 PM »

According to some quick tests, both the Railgun and the Light Dual Autocannon have their projectiles go at the proper speed (1000 and 800 respectively), and it doesn't get clamped.

Asteroids, ships, and missiles do get clamped to 600, though.

The following collisionClasses are exempt from speed clamping:
NONE
RAY
RAY_FIGHTER
PROJECTILE_FF
PROJECTILE_NO_FF
PROJECTILE_FIGHTER
Logged