View Single Post
  #1  
Old 10-14-2016, 12:15 PM
willpower2727 willpower2727 is offline
Member
 
Join Date: Feb 2015
Posts: 39
Cool Interpolated scaling or force?

I'm trying to visually enhance an explosion (mesh bomb from 3ds converted to osgb) with the fire.osg. I want to make the fire osg expand rapidly but not instantaneously. I can re-scale it but the change is too abrupt. I have tried applying a force but it only moves the whole object in one specified direction. I'd like it to sort of blow up in all directions. Any ideas? Here's what I've tried so far:

import viz
import vizact

viz.go()
fire = viz.addChild('fire.OSG',scale=[2,2,2])
fire.hasparticles()

viz.phys.enable()
viz.phys.setGravity(0,0,0)
firep = fire.collideSphere()

def rescale():
print('rescale')
fire.setScale([1,1,1])

def explode():
print('apply force')
fire.applyForce( dir=[100,0,0],duration=5)
# fire.setScale([4,4,4])


viz.MainView.setPosition(0,0,-1.5)

vizact.onkeydown(' ',rescale)
vizact.onkeydown('s',explode)
Reply With Quote