|
Post by Slenkar on May 18, 2004 1:05:30 GMT
Please can you give me some hints on how to create a function that places a 3D object at certain 2D screen co-ords instead of a sprite?
|
|
|
Post by syntaxerror on May 21, 2004 17:37:10 GMT
EDIT
See new example below
|
|
|
Post by Slenkar on May 22, 2004 20:16:31 GMT
thee xample works great, but in the game the sphere isnt orientated to the sprite camera.
|
|
|
Post by syntaxerror on May 23, 2004 9:31:35 GMT
Does PointEntity myentity,spritecamera help?
|
|
|
Post by Slenkar on May 23, 2004 21:34:28 GMT
I placed the sphere at 0,-1000,0 where the spritecamera is, before the program ran
but it appears at -150,112,150 after the smpositionentity command is applied,
I changed the code to : smPositionEntity sphere,mouse_x,mouse_y-1000,150
but it still didnt appear in fron of the spritecamera
it appeared at 325,15,150
In the SMPRO.BB file there is some function or command that makes the sprites appear in front of the spritecamera whereever it may be but I dont how to apply that command to an object instead.
|
|
|
Post by syntaxerror on May 29, 2004 6:53:07 GMT
This should do the trick ...
AppTitle"SpriteMasterPro - Positioning an entity"
Include "smPro.bb"
; set up sprite display SpriteGraphics 640,480,0,2
; reference sprite sprite.smSprite=CreateSprite(100,18) HandleSprite sprite tex=CreateTexture(100,18) SetBuffer TextureBuffer(tex) Color 210,210,210 Rect 0,0,100,18,True Color 10,10,10 Text 2,2,"SpriteMaster" SpriteTexture sprite,tex FreeTexture tex SetBuffer BackBuffer()
; entity for positioning at 2D coords sphere=CreateSphere() EntityColor sphere,0,255,0
; some random cubes For c=1 To 500 cube=CreateCube() PositionEntity cube,Rnd(-150,150),Rnd(-150,150),Rnd(-150,150) EntityColor cube,Rand(255),Rand(255),Rand(255) Next
; light l=CreateLight()
MoveMouse 170,100
; LOOP START ********************************* Repeat
mx=MouseX() : my=MouseY() PositionSprite sprite,mx,my smPositionEntity sphere,mx,my,15 TurnEntity spritecamera,-0.06,0.3,0.07 MoveEntity spritecamera,0,0,0.1
RenderWorld : Flip
Until KeyHit(1) ; LOOP END ***********************************
; cleanup FreeSprite sprite EndSpriteGraphics End
; position entity at 2D coords (with optional z distance) ; (thanks to James Boyd - BlitzSupport) Function smPositionEntity(ent,x#,y#,z#=10.0 , cam=-1 , camzoom#=1.0) If cam<0 cam=spritecamera Local gw=GraphicsWidth() Local gh=GraphicsHeight() Local xp#=-((gw Shr 1)-x) Local yp#= (gh Shr 1)-y EntityParent ent,cam Local div#=(gw/(2/camzoom))/z PositionEntity ent,xp/div,yp/div,z End Function
|
|
|
Post by syntaxerror on May 29, 2004 6:57:01 GMT
NOTE: I was getting flickering of the sprite to start with. You may need to do what I did and modify the smPro.bb lib. Specifically the SpriteGraphics command. Change the default pivotdist# to 1.0001
EG: Function SpriteGraphics(gw%,gh%,d%=0,m%=0,pivotdist#=1.0001)
|
|
|
Post by Slenkar on Jun 28, 2004 21:58:42 GMT
Thanks JimB very useful for my game!
|
|
|
Post by Slenkar on Oct 8, 2004 22:32:45 GMT
I found out that the rotation AND movement of the spritecamera is the reason the sprite was flickering.
If a seperate spritecamera is used for sprites then this wont be a problem.
|
|
|
Post by Slenkar on Oct 19, 2004 17:26:59 GMT
Is there any way to get the 3d object flat? so that it doesnt look different when you move it around the screen? I changed the camera mode to orthographic but it didnt make much difference.
|
|
|
Post by zhanhuichuangg on Oct 13, 2011 2:06:24 GMT
Well I believe we, the Americans of today, timberland boots are ready to act worthy of ourselves, ready to do what must be done to insure happiness and liberty for ourselves, our children, and our children¡¯s children. And as we renew ourselves here in our own land, timberland 3 eyes shoes will be seen as having greater strength throughout the world. We will again be the exemplar of freedom and a beacon of hope for those who do not now have timberland classic boat shoes. To those neighbors and allies who share our freedom, we will strengthen our historic ties and assure them of our timberland 6 inch boots and firm commitment. We will match loyalty with loyalty. We will strive for mutually beneficial relations. We will not use our mens timberland 6 inch boots to impose on their sovereignty, for our own sovereignty is not for sale. As for the enemies of freedom, those who are potential adversaries, they will be reminded that peace is the highest aspiration of womens 14 timberland boots. We will negotiate for it, sacrifice for it; we will not surrender for it -- now or ever. Our timberland mens chukka should never be misunderstood. Our reluctance for conflict should not be misjudged as a failure of will. When action is required to preserve our national security, we will act. timberland boots women will maintain sufficient strength to prevail if need be, knowing that if we do so, we have the best chance of never having to use that strength. Above all black timberland boots must realize that no arsenal or no weapon in the arsenals of the world is so formidable as the will and moral courage of free timberland boots for men. It is a weapon our adversaries in today's world do not have. It is a weapon that we as timberland 6 inch premium do have. Let that be understood by those who practice terrorism and prey upon their neighbors. timberland shoestimberland boat shoestimberland boots sale ZHC
|
|