Gravity Simulation in SCI: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
m 2 revisions imported
Andrew Branscom (talk | contribs)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Official SCI Documentation]]<br />
[[Category:SCI Pages]]
[[Category:SCI Pages to be Edited]]


<div align="center"><span style="font-size: 22pt">Gravity Simulation in SCI</span></div>
<div align="center"><span style="font-size: 22pt">Gravity Simulation in SCI</span><br />''By [[]]''</div>


<br />
==<br /> Introduction ==


 
Standard gravitational acceleration is 9.8 m/s/s.  To convert this to the SCI simulation units of pixels/cycle/cycle, we CAN use the following formula
Standard gravitational acceleration is 9.8 m/s/s.  To convert this to the
SCI simulation units of pixels/cycle/cycle, we use the following formula


<blockquote><div class="CodeBlockHeader">SCI Code:</div>
<blockquote><div class="CodeBlockHeader">SCI Code:</div>
Line 39: Line 40:
===<br /> JumpTo ===
===<br /> JumpTo ===


The JumpTo motion class is designed to allow an actor to jump to a certain
The JumpTo motion class is designed to allow an actor to jump to a certain point on the screen.  This is done by assuming that, in the Jump class, the horizontal and vertical speeds are related by the scale factor n.  We then solve for the magnitude which gets us where we want to go.
point on the screen.  This is done by assuming that, in the Jump class, the
horizontal and vertical speeds are related by the scale factor n.  We then
solve for the magnitude which gets us where we want to go.


The x coordinate of the endpoint is given by
The x coordinate of the endpoint is given by
Line 92: Line 90:
<references />
<references />


===<br /> See Also: ===
==<br /> Related Links ==


* [[SCI Specifications]]
* [[SCI Specifications]]
 
* [[Official SCI Documentation]]
 
<!-- * [[Media:.pdf|Download  Documentation in PDF Form]] -->
<!-- [[Media:.pdf|Download  Documentation in PDF Form]] -->
&nbsp;
 
 
[[Category:References]]
[[Category:References]]
[[Category:SCI References]]
[[Category:SCI References]]

Latest revision as of 16:06, 29 April 2025


Gravity Simulation in SCI
By [[]]



Introduction

Standard gravitational acceleration is 9.8 m/s/s. To convert this to the SCI simulation units of pixels/cycle/cycle, we CAN use the following formula

SCI Code:
	g = 9.8 * h/(f ** 2)

where

h is the height, in pixels, of a one meter tall object

f is the frequency, in cycles/second, of the animation cycles


Normal animation speed is 10 animation cycles/second, so in general this reduces to

SCI Code:
	g = .098 * h


A standard sized actor is about 33 pixels tall. Assuming that the actor is a meter tall, we get a default g of

SCI Code:
	g = 3.23
	  = 3


JumpTo

The JumpTo motion class is designed to allow an actor to jump to a certain point on the screen. This is done by assuming that, in the Jump class, the horizontal and vertical speeds are related by the scale factor n. We then solve for the magnitude which gets us where we want to go.

The x coordinate of the endpoint is given by

SCI Code:
	x1 = x0 + v * t

so that

SCI Code:
	t = (x1 - x0)/v

The y coordinate is given by

SCI Code:
	y1	= y0 + n * v * t + g * t**2/2

		= y0 + n * v * (x1 - x0)/v + g * (x1 - x0)**2/(2 * v**2)

writing

SCI Code:
	dx = x1 - x0
	dy = y1 - y0

we have

SCI Code:
	dy - n * dx = g * dx**2/(2 * v**2)

so that

SCI Code:
	v = sqrt(g * dx**2/(2 * (dy - dx)))


References



Related Links