Physics values and time scaling request

New releases and general discussions.

Post » Wed Oct 01, 2008 6:09 pm

I know I've mentioned this before, but I've ran into a situation where it would be good to have it fixed.
Would it be possible to make the physics values in pixels per second? Because the player in my game uses physics right, but I want to apply that super speed thing that i made in that example a while ago, except that since physics values are inconsistant with pixels per second, it all goes wrong.

Physics example: (not entirely real syntax)
Set X Velocity to (cos(Player.Angle) * 200) * (1 / timescale)
will not have the same effect as:

custom example:
Set X to Player.X + (cos(Player.Angle) * (200 * timedelta)) * (1 / timescale)
will work fine

Anyway, I'm pretty sure it's the physics value inconsistancy that's causing this problem because all the non-physics things on my player such as, rotation speed, jumping, all work fine with the super speed thingy.
Although hopefully I'm wrong and it works fine and i'm just doing something wrong :D
(also how do i post attachments? :) )
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Thu Oct 02, 2008 2:00 am

Oh sorry, I forgot to mention that you only see the differences between the two if you are switching between a really low timescale (eg: 0.001) and normal timescale.
I would upload an example but i dunno how to attach files in the forum like the devs do, that and I'm at college where there is rather high net restrictions ;)
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Thu Oct 02, 2008 1:48 pm

Physics should still respond to time scaling - I remember testing it - it should change speed appropriately. But you're right, it would be useful to have velocities working in pixels per second, but the maths behind it is a bit tricky (I'm not sure how to represent forces in terms of pixels...).

You can upload files to the upload forum - us admins have omnipotent attachment powers ;)
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Sat Oct 04, 2008 12:31 am

I've uploaded a little example in the uploads, you're right though, the physics objects DO slow down properly with timescaling
But what i'm doing is speeding the player up the same ratio that timescaling slows everything down, making the player appear to be moving normal speed when if fact they're going really fast.
Basically it's like:

Left is down -- Set PLayer.X to .X + ((200 * timedelta) * (1 / timescale))

The (1 / timescale) makes it so if the timescale is, for example, 0.5, meaning half speed, the player moves at 2 times faster than he normally would, making it look like normal speed but only on the player, everything else affected by timedelta will slow down.
Anyway, the problem is, if i'm using physics values to do such a thing, the physics objects behaves differently to what the object would if i just made a custom movement for it, i THINK it's because the physics values aren't in pixels per second, but it could be some other factors too
A similar problem happens with my super speed example, if motion blur is on, holding forward whilst slowing time down, makes the player jump around a bit, and if you're making him go like, 1000000 times faster, it's er quite interesting
B
3
S
2
G
5
Posts: 351
Reputation: 2,377


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests