当前位置:网站首页>Preliminary understanding of Panda3D audio and advanced interactive components
Preliminary understanding of Panda3D audio and advanced interactive components
2022-07-27 23:24:00 【bcbobo21cn】
function panda3d Tut-Music-Box.py Example ;
Here's the picture , Clicking the button has an effect of opening and closing the box , You can also play different music ;

Panda Divide the audio system into two categories : Sound effects , music ;
Panda There are three kinds of audio libraries :openAL,FMOD,Miles;
self.musicBoxSound = base.loadMusic('music/musicbox.mp3'), Load audio file ;
self.lidSfx = base.loadSfx('music/openclose.mp3'), Load sound effects ;
use pview Take a look at the model , Here's the picture ;
Look at the code of the interface separately ;
import direct.directbase.DirectStart
from panda3d.core import NodePath,TextNode
from panda3d.core import Vec3,Vec4
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from direct.interval.SoundInterval import SoundInterval
from direct.gui.DirectSlider import DirectSlider
from direct.gui.DirectButton import DirectButton
from direct.interval.MetaInterval import Sequence,Parallel
from direct.interval.LerpInterval import LerpFunc
import sys
class World(DirectObject):
def __init__(self):
self.slider = DirectSlider(pos = Vec3(0,0,.7), value = .50,
command = None)
self.button = DirectButton(pos = Vec3(.7,0,.7), text = "Open Box",
scale = .1, pad = (.5, .5),
rolloverSound = None, clickSound = None,
command = None)
w = World()
run()Run the following ; Buttons and sliders are used DirectXXX Class ; This is part of the advanced interaction component provided by the system ;
Take a look at the code related to the model alone ,
import direct.directbase.DirectStart
from panda3d.core import NodePath,TextNode
from panda3d.core import Vec3,Vec4
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from direct.interval.SoundInterval import SoundInterval
from direct.gui.DirectSlider import DirectSlider
from direct.gui.DirectButton import DirectButton
from direct.interval.MetaInterval import Sequence,Parallel
from direct.interval.LerpInterval import LerpFunc
import sys
class World(DirectObject):
def __init__(self):
self.musicBox=loader.loadModel('models/MusicBox')
self.musicBox.setPos(0, 60, -10)
self.musicBox.reparentTo(render)
#Finding pieces of the model
self.Lid = self.musicBox.find('**/lid')
self.Panda = self.musicBox.find('**/turningthing')
self.HingeNode = self.musicBox.find('**/box').attachNewNode('nHingeNode')
self.HingeNode.setPos(.8659,6.5,5.4)
#WRT - ie with respect to. Reparents the object without changing
#its position, size, or orientation
self.Lid.wrtReparentTo(self.HingeNode)
self.HingeNode.setHpr(0,90,0)
w = World()
run()Run the following , Only one box can be seen ;
In terms of code ; Is to load the model , Then look for different parts of the model , Set to these nodes ,self.Lid,self.Panda,self.HingeNode ;
I don't know how to open and close the box , Go on next time ;
边栏推荐
- Basic SQL DQL
- 2022/4/8 exam summary
- Exam summary on May 13, 2022
- The principle and demonstration of service path lifting without quotation marks
- Gstore weekly gstore source code analysis (V): log tracking of security mechanism
- "The faster the code is written, the slower the program runs."
- Arm32进行远程调试
- 毕设-基于SSM高校后勤管理系统
- Cloudcompare & PCL platform convex hull method to calculate crown volume
- 【StoneDB故障诊断】数据库实例crash
猜你喜欢

Quartus:Instantiation of ‘sdram_ model_ plus‘ failed. The design unit was not found.

浅谈数仓的数据治理

LANproxy mapping local development environment

Tips and extensions of graph theory

Deploy dolphin scheduler high availability cluster based on rainbow

【软考软件评测师】2014综合知识历年真题

Read an article to understand artificial neural network

Introduction to the paper | language model for long text under transformer architecture

Cloudcompare & PCL platform convex hull method to calculate crown volume

物联网架构完全指南
随机推荐
CSDN dedicated killer technology -- Google browser plug-in
Node red series (30): use persistent UI table to refresh the page without emptying the last table data
Deploy dolphin scheduler high availability cluster based on rainbow
[noi2018] bubble sort (combination + Cartland number +dp+ tree array)
简单实用的数据可视化案例
毕设-基于SSM高校后勤管理系统
AWS DynamoDB运用技巧
Px4 module design part 13: workqueue design
cron 表达式
【数字识别】基于知识库实现手写体数字识别附matlab代码
VIM editor tutorial
营收、利润两位数增长,华润怡宝悄悄打造了这些过亿新品
2022/5/18 exam summary
Keming food: the average increase in the sales price of various series of products is about 5%
Leetcode-461. Hamming distance
Fluorescence imaging of cle19 polypeptide in cells preparation of fluorescence quenching quantum dots of bovine serum albumin
Harmonyos third operation
Basic SQL DDL
Object creation process and object layout
Read an article to understand artificial neural network