GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Script/race.ks at master · pacrox/Script

Expand file tree

/

race.ks

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
107 lines (74 loc) · 3.55 KB
/

race.ks

Copy path

File metadata and controls

107 lines (74 loc) · 3.55 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
@LAZYGLOBAL on.
function listGates {
list targets in all_targets.
set new_list to list().
set counter to 0.
set c to 0.
until c = all_targets:length {
for target in all_targets {
if target:name = "Gate " + counter {
new_list:ADD(target).
set counter to counter +1.
}
}
set c to c + 1.
}
global gatesList is new_list.
global gateI is -1.
}
function nextGate {
set gateI to gateI + 1.
if gateI = gatesList:length set gateI to 0.
global targetGate is gatesList[gateI].
local nextI is gateI + 1.
if nextI = gatesList:length set nextI to 0.
global nextTargetGate is gatesList[nextI].
global gateLeft is targetGate:partstagged("left")[0].
global gateRight is targetGate:partstagged("right")[0].
global gateHeight is max(0,targetGate:geoposition:terrainheight).
if targetGate:rootpart:tag = "corner" set gateCorner to true.
else set gateCorner to false.
set targetString to targetGate:name.
//setting the speed limit through the gate:
local targetGateFacing is vxcl(upVector,targetGate:facing:vector):normalized.
local nextGateFacing is vxcl(upVector,nextTargetGate:facing:vector):normalized.
set nextGateSideVec to vcrs(upVector,nextGateFacing):normalized. //vector pointing out from the gate's *right* side
if vang(nextGateSideVec,vxcl(upVector,targetGate:position - nextTargetGate:position)) < 90 set nextGateSideVec to -nextGateSideVec.
local gateToNextGate is vxcl(upVector,nextTargetGate:position - targetGate:position).
//local nextSideDist is abs(vdot(nextGateSideVec,targetGate:position - nextTargetGate:position)).
local nextSideDist is vxcl(nextGateFacing,gateToNextGate):mag.
local nextSideAcc is maxHA * 1.
//set nextSideAcc to nextSideAcc * min(1,100 + abs(nextSideDist)/200).
local nextSideDuration is 1.
//local side_acc_distance is (vdot(nextGateSideVec,h_vel) * nextSideDuration) + (0.5 * nextSideAcc * (nextSideDuration^2)).
local gateSideSpeed is sqrt(2*nextSideDist*nextSideAcc).
set nextSideDist to max(1,nextSideDist - gateSideSpeed * 0.5). //assume 0.5 second is used for orienting drone
set gateSideSpeed to sqrt(2*nextSideDist*nextSideAcc).
global gateSpeed is gateSideSpeed / max(0.01,vdot(targetGateFacing,nextGateSideVec)).
if vang(targetGateFacing,nextGateFacing) > 90 set gateSpeed to gateSpeed * (vdot(nextGateSideVec,targetGateFacing)/1.2).
if vdot(targetGateFacing,gateToNextGate) < 0 set gateSpeed to 20 + gateToNextGate:mag/20. //next gate behind current one
local angleToNextGate is vang(targetGateFacing,gateToNextGate - nextGateFacing * min(400,gateToNextGate:mag/3)).
global maxApproachAngle is min(30,angleToNextGate).
if vdot(vcrs(upVector,targetGateFacing):normalized,gateToNextGate) < 0 set maxApproachAngle to -maxApproachAngle.
set tempFacing to angleaxis(maxApproachAngle, upVector) * targetGateFacing.
set gateDistVecOld to gateToNextGate.
set gateFirstIteration to true.
set gateSpeed to max(25,min(340,gateSpeed)).
//global gateSpeed is (nextSideDist^0.8) * (1 + (TWR - 4)/8) * 2.
entry("Gate Speed Limit: " + round(gateSpeed) + " m/s").
//popup("Gate Speed Limit: " + round(gateSpeed) + " m/s").
set destinationLabel to targetString.
//local test is (targetGate:position-nextTargetGate:position):mag/(2*tan(vang(targetGate:facing:vector,nextTargetGate:facing:vector)/2)).
}
function detectIntersect {
local result is false.
if gateDist < 10 {
if vdot(h_vel:normalized,gateDistVec) < 2 {
if vdot(-sideVec,gateRight:position) > 0 and vdot(sideVec,gateLeft:position) > 0 {
set result to true.
}
}
}
return result.
}
//
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.