-
Posts
42 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Foolish
-
-
Joh,
So what approach did you decide on for your lasers?
-
I'll be the guy who endorses Blitzmax then. If you come from a BASIC background, and hate pointers, addressof, and you aren't going pro, then you might want to look at Blitzmax with the BlIDE IDE.
-
Sure amigo. Thanks for the tip.
-
After days of experimenting, here is the magic order of operations that allowed me to have smoother movement with a "drifting third person camera" without requiring a pivot.
'Main loop
While Not KeyHit(KEY_ESCAPE)
If KeyHit(KEY_ESCAPE) Exit
If AppTerminate() Exit
player.Update() 'captures my keyboard input, applies forces to the fighter.
fw.Update()
fw.Render()
PositionEntity(fw.Main.camera, EntityPosition(player.model))
RotateEntity(fw.Main.camera, EntityRotation(player.model))
MoveEntity(fw.Main.camera, Vec3(0, 1, - 2.5))
Flip
Wend
-
I think you nailed it. Parenting to the model will always be shaky. Parenting to a pivot is the way to go - at least when using Framework.
-
Remove UpdateFramework() also why this is called on loop?:
Else 'using pivot EntityParent(fw.Main.camera, player.camPivot) PositionEntity(fw.Main.camera, EntityPosition(player.camPivot)) End If
Parenting a cam to a pivot it's something you should do just once..
I still get the shaky camera. I have minimized my loop to just what causes the shaky camera. I had the other code in there before to demonstrate that using the pivot allowed smooth movement. The following code excerpt, which maneuvers the camera is what creates the jerky results.
'SetStats(2)
EntityParent(fw.Main.camera, Null)
'Main loop
While Not KeyHit(KEY_ESCAPE)
DebugPhysics KeyDown(KEY_P)
player.Update()
PositionEntity(fw.Main.camera, EntityPosition(player.model))
RotateEntity(fw.Main.camera, EntityRotation(player.model))
MoveEntity(fw.Main.camera, Vec3(0, 1, - 2.5))
fw.update()
fw.Render()
Flip
Wend
-
You are calling UpdateFramework() twice.
I wish it was that simple. That second call is left over from troubleshooting this. Removing "updateframework" has no impact at all.
-
..i dont know have you succeeded, and guys previously already did proper explanation, so ill just post some code, how it should look like..so..material file should be as it was already exposed :
texture0="abstract::cagebulb.dds" texture2="abstract::cagebulb.dds" castshadows=0 collisiontype=0 color=1.0,0.9,0.6,1.0 shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_glow.frag"
and then, here is example with use if framewerk so it will be very easy to set up and try..
SuperStrict Framework leadwerks.framewerk RegisterAbstractPath(AppDir) Graphics(800, 600) LogStreamEnabled = False'AppLogMode equivalent Local fw:TFramewerk fw = TFramewerk.Create() If Not fw RuntimeError "Failed to initialize engine." fw.renderer.SetBloom(True)'here your cagebulb glow will be turned on/off fw.renderer.setHDR(True)'here your glow effect can be more exposed if HDR is enabled (only SM4 cards)..glow will work just fine without it, but less intense.. 'load a scene LoadMesh("abstract::myScene.gmf") 'just set up your camera to face glowsphere so you can see it MoveEntity(fw.main.camera,vec3(0,3,-3) Local glowSphere:TMesh = createsphere() ;moveentity (glowsphere, vec3(0, 3, 0)) Local glowMaterial:TMaterial = LoadMaterial("abstract::cagebulb.mat") PaintEntity(glowSphere, glowMaterial) Repeat fw.Update() fw.Render() Flip(0) Until KeyHit(KEY_ESCAPE) End
..and that should be pretty much all...i hope it helps..
I can make this example work. Thanks. My problem with Framework now goes back to an earlier post related to camera movement.
Moving the camera is code creates very jerky movement unless I use a pivot.
I made a brief video showing the problem here: Jerky Camera Using Framework
I only get this using framework.
My relevant code is as follows:
Framework leadwerks.engine
'Create an OpenGL graphics window
Import "Framework.bmx"
AppTitle = "Working Title"
Const WIDTH = 1024
Const HEIGHT = 768
Graphics WIDTH, HEIGHT
Const FPSVIEW = 1
Const CHASEVIEW = 2
Global ViewType:Int = CHASEVIEW
'Allows the engine to find files and load files from zip packages
RegisterAbstractPath AppDir
fw:TFramework = TFramework.Create()
If Not fw
RuntimeError "Failed to initialize engine"
End If
PositionEntity fw.Main.camera, Vec3(0, 10, - 4)
CameraClearColor(fw.Main.camera, Vec4(0, 0, 0, 1))
CameraRange(fw.Main.camera, 0.1, 3000)
CameraClearMode(fw.Main.camera, BUFFER_DEPTH)
'add a light
light:TLight = CreateDirectionalLight()
RotateEntity light, Vec3(45, 45, 0)
'load the scene
scene:TEntity = LoadScene("abstract::scene.sbx")
If Not scene RuntimeError "Failed to load scene"
'set collisions
Collisions(1, 1, True)
Global player:TTIEF
player = New TTIEF
player.SetPosition (0, 50, - 2000)
LoadTestTower()
SetSkybox(LoadMaterial("abstract::skybox.mat"))
HideMouse
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
'SetStats(2)
'Main loop
While Not KeyHit(KEY_ESCAPE)
DebugPhysics KeyDown(KEY_P)
If KeyDown(KEY_S) Then SaveBuffer(gbuffer, "screenshot.jpg")
If KeyDown(KEY_F1) Then ViewType = FPSVIEW
If KeyDown(KEY_F2) Then ViewType = CHASEVIEW
UpdateFramework()
player.Update()
'Position Camera
If ViewType = CHASEVIEW 'no pivot
EntityParent(fw.Main.camera, Null)
PositionEntity(fw.Main.camera, EntityPosition(player.model))
RotateEntity(fw.Main.camera, EntityRotation(player.model))
MoveEntity(fw.Main.camera, Vec3(0, 5, - 10))
Else 'using pivot
EntityParent(fw.Main.camera, player.camPivot)
PositionEntity(fw.Main.camera, EntityPosition(player.camPivot))
End If
fw.update()
fw.Render()
If ViewType = FPSVIEW Then
DrawText "View Type: Using Pivot", 0, 80
Else
DrawText "View Type: Rotating Cam", 0, 80
End If
Flip
Wend
I have also played around with resizing the model in case its a rounding error with floats, but that didn't seem to help. Not moving the camera keeps everything smooth as well.
Any thoughts?
-
Thanks guys.
-
Could you show us the whole code so we can try to help you?
Joh, do you think you might have a chance to look at this? Thanks.
-
Showing my age here. - Current All-Time
TIE FIGHTER
Command & Conquer Red Alert
Total Annhiliation
Call of Duty 2
Quake 3
-
Could you show us the whole code so we can try to help you?
Thanks for your time.
Framework leadwerks.engine
'Create an OpenGL graphics window
Graphics 800, 600
'Allows the engine to find files and load files from zip packages
RegisterAbstractPath AppDir
'Create a world
If Not CreateWorld() RuntimeError "Failed to create world."
'Create a camera
cam:TCamera = CreateCamera()
CameraClearColor(cam, Vec4(0, 0, 0, 1))
RotateEntity(cam, Vec3(35, 0, 0))
MoveEntity cam, Vec3(0, 2, - 2)
buffer:TBuffer = CreateBuffer(800, 600, BUFFER_COLOR0 | BUFFER_DEPTH | BUFFER_NORMAL)
DebugLights(True)
model:TModel = LoadModel("abstract::fixture_cagelight.gmf")
If Not model RuntimeError "Failed to load cagelight"
'add a pointlight
plight:TLight = CreatePointLight(4, model)
SetShadowSoftness(plight, 2)
SetShadowmapSize(plight, 512)
SetLightRange(plight, 2)
plight_material:TMaterial = CreateMaterial()
SetMaterialTexture(plight_material, LoadTexture("abstract::cagebulb.dds"))
PaintEntity(plight, plight_material)
AmbientLight Vec3(1)
PositionEntity model, Vec3(0, 2, 0)
'Main loop
While Not KeyHit(KEY_ESCAPE)
TurnEntity model, Vec3(0, 0.5, 0)
'Update timing, physics, and other miscellaneous updates
UpdateWorld
'Draw the world
SetBuffer(buffer)
RenderWorld
'Swap the graphics buffers so we can see what we drew
SetBuffer(BackBuffer())
RenderLights(buffer)
Flip
Wend
The screenshot shows what I'm getting. Not quite the bright light of the tunnel demo.
Thanks again.
-
Its funny. Using Framework, the camera's movements are jerky and it makes my ship look like it is vibrating violently. When I don't use framework, its fine, but getting the advanced effects are ten times harder.
In your example, you use a cube. Have you used a model with it yet? I am wondering if the physics body is messing me up.
When I comment out the camera positioning, the TIE moves fine as does when I use the pivot.
I am still stuck trying to reproduce a simple use of the GLOW shader working such as the cagelight in the tunnels example. Any BMAXers out there have a working example of something like this?
-
Actually the thread you are referencing is all about the problems that arose from that approach. In the end I went for this approach for a basic third person camera:
http://leadwerks.com/werkspace/index.php?/topic/800-basic-3rd-person-camera/
And then to this:
http://leadwerks.com/werkspace/index.php?/topic/832-updated-basic-3rd-person-camera/
Its funny. Using Framework, the camera's movements are jerky and it makes my ship look like it is vibrating violently. When I don't use framework, its fine, but getting the advanced effects are ten times harder.
In your example, you use a cube. Have you used a model with it yet? I am wondering if the physics body is messing me up.
When I comment out the camera positioning, the TIE moves fine as does when I use the pivot.
-
I am not sure what category this question comes under but is it possible to have an animated character run across a scene and knock over an object such as a oildrum or crate etc?
You should be able to fine. You may need to play with values like mass. Use setbodymass fcor example.
-
and it was a good idea too Puki.
-
Great news Foolish
Looking foward to go through them.
Thanks
Gimpy73
Done.
-
File Name: Tutorial 15-17: Animation, Sky, Collision, and Raycasting
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Category: BlitzMax Code
Source code only! Download assetts from the link provided by the tutorials.
- 1
-
File Name: Tutorials 13,14: Spectator, Character Controller
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Category: BlitzMax Code
Spectator, Character Controller
-
File Name: Tutorial 12: Heat Haze
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Category: BlitzMax Code
BMAX Version
-
File Name: Tutorial 11: Intro to Particles
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Updated: 14 Apr 2010
File Category: BlitzMax Code
Intro to Particles. BMAX version
-
File Name: Tutorials 9-10: Materials, Shaders, Transparency, Reflection
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Updated: 14 Apr 2010
File Category: BlitzMax Code
Tutorial 9 - Materials and Shaders
Tutorial 10 - Transparency and Reflection
-
File Name: Tutorials 6,8: Sound and Models
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Updated: 14 Apr 2010
File Category: BlitzMax Code
More BMAX source and resources
These can be consolidated into the same directory as the first zip or saved seperately.
06 - Intro to Sound
08 - Intro to Models
-
File Name: Tutorials 1-5: Test, Lights, Camera, Meshes, Bodies
File Submitter: Foolish
File Submitted: 14 Apr 2010
File Updated: 14 Apr 2010
File Category: BlitzMax Code
Source code and resources
Upated for LE 2.3 and BMAX 1.38
1 - Test
2 - Lights
3 - Camera Controls
4 - Intro to Meshes
5 - Intro to Bodies
Deciding on an Engine...
in General Discussion
Posted
I have used older versions of Torque. You can get something up and running quickly, especially multiplayer, but than you can hit a pretty solid wall. Bugs can be extremely difficult to troubleshoot. And the forums needed cleaned out at the time. Still, the advantage of having your multiplayer component very accessible is a big win.
As an amateur/hobbyist programmer, I feel LE gives me lot of freedome, and though I hit walls, I steadliy overcome them. It just feels like more things are possible in LE.