hey! help!

Blitz3D Forums/Blitz3D Beginners Area/hey! help!

hey, need som help here.
if i want to get my gun at my hand and on in a usual fps
whats the code? do i ned a campivot? and link them and stuff?

EntityParent() is what you need :)

In the future, please try to put something useful in the topic title. "hey! help!" doesn't help someone searching the forums later who is having the same problem you are.

Call me a whiner if you will, but your nick is offensive to me.

WarrenM:
I agree
markd:
I agree too...

WTF? Who gives a s**t about someones nick? Behave yourselves!

Satanist: An individual who gives time, thought, and credence to the Devil.

This means mostly Christians

So MR:Satanist is simply another name for MR:Christian

But "hey! help!", is a stupid name for a thread, and you should be shot.

lol :)

>Satanist: An individual who gives time, thought, and credence to the Devil.

Satan and the Devil are not one and the same..

Satan (shaitan: meaning adversary) was God's right hand man.

Devil - didn't exist in the Bible until after 400AD, and looking at common depictions was most likely based on the God Pan.

But yes, to give creedence to either would require some belief in Christianity.

Well I hope I won't be accused of dealing with the devil but...
With animated meshes it is best to parent items to the bones. The bone/Joint name becomes the entity name. Use the FindChild(mesh,bonename$) to find the bone you want ( its recursive by default). Once you have it you can parent anything to this bone.
Here's an example - I have modified this code to load and parent a pistol model to Psionic's ninja. You may need to tweak scale and position of the pistol once parented to get it to look right but once done the pistol will move quite happily with the hand. You may need to modify the path names to the models depending on where you have them located. Make sure that the textures are in the same folder as the model.
This also demonstrates how you can manipulate the head bone as well using the same technique.

; ID: 660
; Author: Smiff
; Date: 2003-04-25 21:21:11
; Title: .b3d Animation using ExtractAnimSeq
; Description: An Example of using The ExtractAnimSeq Command

;**********************************************************************************
; 
;	B3D Animation Example using ExtractAnimSeq ------------------- Ricky Smith April 2003
;
;
;   Use Keys Q through to  X  to transpose  animation sequences.
;
;	Use the Cursor Keys to Pitch and Yaw the Ninjas Head 
;   - this will blend with the currently running animation
;   
;   You will need the B3D Animated Ninja Model "Ninja.b3d"
;   Kindly  donated by Psionic available at
;   
;   <a href="http://www.psionic3d.co.uk" target="_blank">http://www.psionic3d.co.uk</a>

;   Many Thanks to Psionic. 


;  Animation Frames
;
; 1-14     Walk (normal) 
; 15-30     Stealth Walk
; 32-44     Punch And swipe sword
; 45-59     Swipe And spin sword
; 60-68     Overhead twohanded downswipe
; 69-72  	Up To block position (play backwards To Lower sword If you want)
; 73-83  Forward kick
; 84-93     Pick up from Floor (Or down To crouch at frame 87)
; 94-102	Jump
; 103-111	Jump without height (For programmer controlled jumps)
; 112-125	High jump To Sword Kill (Finish em off move??)
; 126-133	Side Kick
; 134-145	Spinning Sword attack (might wanna speed this up in game)
; 146-158	Backflip
; 159-165	Climb wall
; 166-173	Death 1 - Fall back onto ground
; 174-182	Death 2 - Fall forward onto ground
; 184-205	Idle 1 - Breathe heavily
; 206-250	Idle 2
; 251-300	Idle 3
;**********************************************************************************

Graphics3D 800,600
SetBuffer BackBuffer()
camera=CreateCamera()
MoveEntity camera,0,3,0
CameraViewport camera,0,0,GraphicsWidth(),GraphicsHeight()
AmbientLight 255,255,255

;********** Load Model  and Prepare Animation Sequences

Global ninja=LoadAnimMesh("c:\blitz3d\ninja\ninja.b3d"); This will load All Frames into Sequence 0
Global walk=ExtractAnimSeq (ninja,0,14); Extract frames 0 to 14 into Sequence 1 - the value 1 is assigned to the Global walk
Global stealth=ExtractAnimSeq (ninja,15,30); Extract frames 15 to 30 into Sequence 2 - the value 2 is assigned to the Global stealth
Global punch_swipe=ExtractAnimSeq (ninja,32,44); And so on extracting each set of frames into a seperate sequence 
Global swipe_spin=ExtractAnimSeq (ninja,45,59); and assigning the sequence number to a global variable.
Global overhead=ExtractAnimSeq (ninja,60,68)
Global block=ExtractAnimSeq (ninja,69,72)
Global fwd_kick=ExtractAnimSeq (ninja,73,83)
Global pickup=ExtractAnimSeq (ninja,84,93)
Global jump=ExtractAnimSeq (ninja,94,102)
Global jump_static=ExtractAnimSeq (ninja,103,111)
Global jump_kill_sword=ExtractAnimSeq (ninja,112,125)
Global sidekick=ExtractAnimSeq (ninja,126,133)
Global spin_sword_attack=ExtractAnimSeq (ninja,134,145)
Global backflip=ExtractAnimSeq (ninja,146,158)
Global climb_wall=ExtractAnimSeq (ninja,159,165)
Global death_fall_back=ExtractAnimSeq (ninja,166,173)
Global death_fall_fwd=ExtractAnimSeq (ninja,174,182)
Global idle_breathe_heavy=ExtractAnimSeq (ninja,184,205)
Global idle_2=ExtractAnimSeq (ninja,206,250)
Global idle_3=ExtractAnimSeq (ninja,251,300)
Global crouch=ExtractAnimSeq (ninja,84,87)
;
;locate the head bone in the model and assign it to the Global 'head'
Global head=FindChild(ninja,"Joint7")
;locate the left hand bone in the model and assign it to the Global 'hand'
Global hand=FindChild(ninja,"Joint17")

Global gun=LoadMesh("c:\blitz3d\4guns\pistol.3ds")
ScaleMesh gun,.2,.2,.2; tweak these values as required
EntityParent gun,hand,0; Make sure you use the 0 parameter so it is placed at the parents location
RotateEntity gun,40,0,0; tweak these values as required
MoveEntity gun,0,0,1; tweak these values as required
 
;State values
Global s_walk=0
Global s_stealth=1

;Head rotation Variables
Global headyaw,headpitch
Global state
Const transpose = 40
;Position the model 
MoveEntity ninja,0,0,7
ScaleEntity ninja,0.5,0.5,0.5
RotateEntity ninja,0,180,0
;************** Main Loop ***********************************
While Not KeyHit(1)




; Get Cursor Key Input for Manual Head Rotation
If KeyDown(203) Then headyaw=headyaw+1:If headyaw > 90 Then headyaw = 90
If KeyDown(205) Then headyaw=headyaw-1: If headyaw < -90 Then headyaw = -90
If KeyDown(200) Then headpitch=headpitch+1: If headpitch > 30 Then headpitch= 30
If KeyDown(208) Then headpitch=headpitch-1 : If headpitch < -45 Then headpitch= -45


; Get Key Input for Animation sequence change
If KeyHit(16)  Then  Animate ninja,1,0.1,walk,transpose:state=s_walk
If KeyHit(17)  Then  Animate ninja,1,0.1,stealth,transpose:state=s_stealth
If KeyHit(18)  Then  Animate ninja,3,0.1,punch_swipe,transpose
If KeyHit(19)  Then  Animate ninja,3,0.1,swipe_spin,transpose
If KeyHit(20)  Then  Animate ninja,3,0.1,overhead,transpose
If KeyHit(21)  Then  Animate ninja,3,0.1,block,transpose
If KeyHit(22)  Then  Animate ninja,3,0.1,fwd_kick,transpose
If KeyHit(23)  Then  Animate ninja,3,0.1,pickup,transpose
If KeyHit(24)  Then  Animate ninja,3,0.1,jump,transpose
If KeyHit(25)  Then  Animate ninja,3,0.1,jump_static,transpose
If KeyHit(30)  Then  Animate ninja,3,0.1,jump_kill_sword,transpose
If KeyHit(31)  Then  Animate ninja,3,0.1,sidekick,transpose
If KeyHit(32)  Then  Animate ninja,3,0.1,spin_sword_attack,transpose
If KeyHit(33)  Then  Animate ninja,3,0.1,backflip,transpose
If KeyHit(34)  Then  Animate ninja,1,0.1,climb_wall,transpose
If KeyHit(35)  Then  Animate ninja,3,0.1,death_fall_back,transpose
If KeyHit(36)  Then  Animate ninja,3,0.1,death_fall_fwd,transpose
If KeyHit(37)  Then  Animate ninja,1,0.1,idle_breathe_heavy,transpose
If KeyHit(38)  Then  Animate ninja,1,0.1,idle_2,transpose
If KeyHit(45)  Then  Animate ninja,1,0.1,idle_3,transpose
If KeyHit(44)  Then  Animate ninja,3,0.1,crouch,transpose



If Not Animating(ninja) Then 

  If state=s_walk Then Animate ninja,1,0.1,walk,40
  If state=s_stealth Then  Animate ninja,1,0.1,stealth,40

End If


UpdateWorld

;Update head rotation
TurnEntity head,headpitch,headyaw,0

RenderWorld
Flip

Wend


You will need the B3D Animated Ninja Model "Ninja.b3d" and the "pistol.3ds" kindly available for free by Psionic available at
http://www.psionic3d.co.uk

code and /code need to be Not caps

@H&K - thanks - edited !

Maybe codebox would be better?

OK codeboxed - happy now ?

thx but can you give me a more accurate help whit the animations? and one more thing, when i aim downwards whit teh gun it gets in the ground and dissapers :O weid!?


satanism is = freedom, got nothign to do whit the devil!
set your mind free, do waht ever you want and dont caer about others!
fu N00bs in Religion, but satanism aint a religion its a wat of mind thinking!

@Ricky - always happy, well almost.

@MR: Almost sounds Thelemic.

MR:FINDINGIDENTITIESINNICKNAMES:


Can you please give us a more accurate question of what you actually are trying to do with the animations. It's hard to help.
If the gun gets in the ground it is actually not weird at all. It's just that it DOES go into the ground. Try making a smaller gun, Having the 'hand' and camera higher above ground and maybe change the camerazoom to compensate for the small... gun.

EntityOrder is your friend.