Camera Question -Coding in Blitz3d-
I'm trying to create a rocking feeling while playing so keep that in mind.
With help off of IRC I have came up with the following code. Basically, it is WolRon's FPS example code with my Code:
RotateEntity camera,Sin(MilliSecs()*.05)*.5,0,Sin(MilliSecs()*.05)*.5 Code:
Graphics3D 800, 600, 0, 1 ;3D graphics at a resolution of 800x600 |
Quote:
Chad use TurnEntity instead of RotateEntity becose RotateEntity set the view to an absolute angle while you want relative motion. You basicaly had a conflict between this two lines of code: Code:
RotateEntity camera,Sin(MilliSecs()*.05)*.5,0,Sin(MilliSecs()*.05)*.5 Chad... ...your code is horrobly to read! lol You should always leave an empty line betwin code segments and also put comments what a code segment is doing so that no one need to read all of the code to understand what it's supposed to do. Enjoy |
Ah your right, it is a messy piece of :|\\
But, yeah, TurnEntity works good. I've got one more piece of eq I want to finish before Wednesday and if I get that done then I'll post a new dev vid of Iron Coffins, first public preview of the new and improved version :yep: Thanks, Chad |
Quote:
|
I will be using Fraps, www.fraps.com
Posted this in your forum too, just making sure you get it, I want to see yours! :ping: And by yours I'm talking about game :|\\ |
Couple of more things to do on my list before I show the vid, and one being getting my rudder in full working order!
Here is the code for my rudder, could you help me by showing me some example code to increase my rudder's turn by 5 degrees each time with a max of 40 degrees? You might have to rework some of this, but I just can't get it to work right with the way I'm doing it. Code:
If I get this out of the way then there's about 5-10 small things left before Video. Thanks, Chad |
Quote:
So show me your pseudo code. Chad don't use bride font for text, since i'm usign the bride style. I can't read the test unless i mark it. |
Ok, finally! I have found time to come back to my rudder question :yep:
Here's something I think it should look like, but doesn't work, so corrections are needed. Just one thing to remember, I'm using Blitz3d. ;Rudder Information For Each KeyHit(26) TurnEntity conn,0,0.03,0 Until conn 0,0.24,0 ;I have it stop at .24 to simulate 40 degrees, because, I want to go in increments of 5 degrees each key press, 5, 10, 15 etc, there would be 8 increments, ;and .03 * 8 = .24 For Each KeyHit(27) TurnEntity conn,0,-0.03,0 Until conn 0,0.24,0 EndIf If KeyHit(40) Then TurnEntity conn,0,0,0 ; rudder amidships |
Quote:
Also explain me what the problem is or give me the full code and i will look it up here. |
I don't know what psuedo code is except that it's in plain language, no coding.
Ready and open subscriber file Get a record Do while more records If current subscriber subscription count is > 3 then Output the record Get another record end Release the subscriber file. is an example of psuedo code, but I really don't know how to put this in for my rudder adjustments |
Quote:
Quote:
You kidden me, ain't you ? :yep: Anyway i will give you an example: Code:
If key(A) is pressed and rudder is > -40, turn rudder to prt by n°/s But why turn it for n° per second ? becose when you not turn it vs time it will be turned by n° each frame. This will have the side effect that the turnrate will always change according to the framerate which always fluctuates and is very different from system to system. If you want to make sure that the rudder never turn more than 40°, cose in the example above it will stop to turn only when it's already above the 40. It will be just a tiny little bit above it maybe not noticeable at all but if you want it to be 100% correct then you can express it like this: Code:
If key(A) is pressed and rudder is > (-40 - n° * Millisec()), turn rudder to prt by n°/s Code:
Ok Chad now show me if you can transform this into code. |
Ok.. let me try this then..
Const n/s = 0.03(1000 Millisec() rudderspin = n/s If keyhit() And Rudder < (-40 : rudderspin) Turn entity 0,-0.03,0 : rudderspin If Keyhit() And Rudder > (40 : rudderspin) Turn Entity 0,0.03,0 :rudderspin |
Quote:
It's pointless to define a constant and apply Millisec() on it cose a constant is being defined only one time but we need to update the turn rate each frame so: Code:
Const n/s = 0.03 And n/s was just an example. Give it an explicite name that is self exaplaining, like: Const rudderTurnCoefficient = 0.03 or Const rudderTurnCoef = 0.03 The turn coefficient appears to me way to low though. Your value meant the rudder will turn 0.03 ° per second. So it will take 22.222221 minutes before the rudder will turn to 40° lol Take maybe 2° or 3° else experiment till you get the desired effect. BTW: The whole point of constants is that they are defined only one time and cannot be changed again. Quote:
Code:
If keyhit() And Rudder < (-40 : rudderspin) Turn entity 0, -rudderspin, 0 When you have made a software that makes many calculations that use that current taxrate and the taxrate gets changed by the government then you would have to change each taxrate entry throughtout the whole code. But when you have used a constant for the taxrate instead a numerical value then all you have to do is to change the declaration of that constant and recompile. And when you have 2 If's from which only one can be true in this pass then use If and ElseIf and not If If. Cose when the first If is true then the second one don't even need to be checked, otherwise you waste speed. So: Code:
If keyhit() And Rudder < (-40 : rudderspin) Turn entity 0, -rudderspin, 0 |
All times are GMT -5. The time now is 10:49 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.