Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1] 2
  Print  
Author Topic: [Resolved] Particle.SetParent crash  (Read 1772 times)
analysis_junky
Customers
Community Member
*****
Posts: 144


WWW
« on: February 05, 2008, 09:01:28 PM »

I am trying to to test attaching particles to actors. Everytime I try though I get:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


This happens with both TVA and .X Actors

Particle = Scene.CreateParticleSystem();
Particle.SetParent(Actor.GetIndex(), CONST_TV_NODETYPE.TV_NODETYPE_ACTOR, boneIndex, 0);

I have tried -1 and 0 for the last param (iSubIndex)

The boneIndex is from here

//Load the ListBox of all bones
 for (int i = 0; i < Actor.GetBoneCount(); i++)
 {
      lbBones.Items.Add(Actor.GetBoneName(i));
 }

Has anyone got this to work? If so, what am I doing wrong?

Thanks in advance!


« Last Edit: February 07, 2008, 07:29:49 PM by analysis_junky » Logged

Project: Eternis Prime
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #1 on: February 06, 2008, 05:22:48 PM »

Actually you got the parameters wrong :

void CTVParticleSystem::SetParent(int iEmitter,cCONST_TV_NODETYPE eObjectType, int iObjectIndex, int iSubIndex)

iEmitter should be an index between 0 and GetEmitterCount-1.
Object type is ok for actor
iObjectIndex should be Actor.GetIndex()
and iSubIndex should be boneindex

Hope this helps
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
analysis_junky
Customers
Community Member
*****
Posts: 144


WWW
« Reply #2 on: February 07, 2008, 08:39:44 AM »


Thanks Sylvain, it now works perfectly!
Logged

Project: Eternis Prime
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #3 on: February 07, 2008, 10:29:15 AM »

Particle = Scene.CreateParticleSystem();
For me even this line fails claiming the CreateParticleSystem function not to be member of the TVScene class. Sad
Logged

analysis_junky
Customers
Community Member
*****
Posts: 144


WWW
« Reply #4 on: February 07, 2008, 01:33:34 PM »


What version of TV are you using. I am using TV 6.5
Logged

Project: Eternis Prime
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #5 on: February 07, 2008, 01:55:04 PM »

yeah, the 6.5 Prerelease
Logged

analysis_junky
Customers
Community Member
*****
Posts: 144


WWW
« Reply #6 on: February 07, 2008, 02:00:25 PM »


This is copied directly from the Onject Browser

MTV3D65.TVScene.CreateParticleSystem(string)
TV3D SDK 6.5 - Managed TV3DEngine
Version: 6.5.2823.21213
Logged

Project: Eternis Prime
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #7 on: February 07, 2008, 02:04:02 PM »

OK I'm just using the TVb3D65, not the MTV3D65, but that one is not even possible to be added to the project, nor can I register it.
Logged

SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #8 on: February 08, 2008, 03:46:40 PM »

What language ?
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #9 on: February 09, 2008, 06:21:30 AM »

Okay, summary of everything:

I'm using the TVb3D65.dll on VB6. I tried to reference the MTV3D65.DLL (from TV3Demo) aswell, but that seems to be a .NET version, which cannot be used in VB6 obviously. I created a simple smoke effect with SDK\tools\particleeditor\ParticleEditor.exe and try to load it in the game, but the whole programm, including VB6 environment crash during the startup. Same happens when I try to initialize a shader.
Are there any VB6 code examples which work with 6.5. so I can exclude it's a coding fault?
Logged

SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #10 on: February 09, 2008, 08:46:27 PM »

The easiest would be that you post the problematic VB6 code here.
We will able to catch directly what's wrong Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #11 on: February 16, 2008, 09:17:33 AM »

Okay this is the definition:
Code:
Public Particles As New TVParticleSystem
Then I try it like in the TVDemo Code:
Code:
Scene.DestroyAllParticleSystems
Particles = Scene.CreateParticleSystem("Rauch")
This aborts with the message "Object does not support this Property or Method"
With this line it works:
Code:
Scene.CreateParticleSystem ("Rauch")
Then I want to load the particle effect itself
Code:
Particles.Load (App.Path & "\buildings\Powerplant\smoke.tvp")
This makes the whole application crash, including VB6 development environment. The use of the following two lines to pregenerate has the same effect:
Code:
Particles.PreGenerate -1, 32
Particles.SetGlobalPosition 0, 1, 0

Same problem for the shader stuff, these are the equivalent lines:
Code:
Public Shaders As New TVShader

Scene.CreateShader "Wasser"
GetShader("Wasser").CreateFromEffectFile App.Path & "\maps\water.fx"
WaterMesh.SetShader GetShader("Wasser")
WaterMesh.SetLightingMode TV_LIGHTING_MANAGED

Thanks for your help Smiley
Logged

pizzayoyo
Customers
Community Member
*****
Posts: 1320


WWW
« Reply #12 on: February 16, 2008, 02:54:06 PM »

Code:
Particles = Scene.CreateParticleSystem("Rauch")

In VB6, when setting an object to an instance you must use the keyword set...

Code:
Set Particles = Scene.CreateParticleSystem("Rauch")
Logged

Insomnia
Community Member
*
Posts: 23


WWW
« Reply #13 on: February 17, 2008, 07:17:27 AM »

Rather a copy/paste mistake, does not change anything on the issue though.
Logged

PrinceValiant
Community Member
*
Posts: 6


« Reply #14 on: February 27, 2008, 06:53:59 PM »

If i understand correctly i think you also have same problem of incorrect Particle Editor file. Look at smoke.tvp in particle editor. If it crashes even the Particle Editor then create working one with correct parameters. I also had the same problem. After correcting the *.tvp file Vb crash ended...

Especially if you set directional=true and Randomgenerator=0/0/0 it generates erroneus TVP file...

Logged
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #15 on: February 28, 2008, 07:50:49 AM »

Okay, the TVP file was not corrupted, except a wrong texture name... after renaming that one, the crashes are gone, but the particle system still does not show up, what do I need to do else?

Initialization:
Code:
[...]
Scene.DestroyAllParticleSystems
Set Particles = Scene.CreateParticleSystem
Particles.Load (App.Path & "\buildings\Powerplant\smoke.tvp")
Particles.SetGlobalPosition 0, 10, 0
Particles.Enable True
[...]

Render Loop:
Code:
[...]
Particles.Render
[...]

Thanks for your help! Smiley
Logged

pizzayoyo
Customers
Community Member
*****
Posts: 1320


WWW
« Reply #16 on: February 28, 2008, 05:06:22 PM »

You also need to do Particles.Update() next to the Particles.Render().
Logged

Insomnia
Community Member
*
Posts: 23


WWW
« Reply #17 on: March 01, 2008, 07:18:01 AM »

Does not change anything either Undecided
Noone ready to write a 5 line application in VB6 with a simple particle effect to demonstrate the correct working to me? That would be very nice!
Logged

analysis_junky
Customers
Community Member
*****
Posts: 144


WWW
« Reply #18 on: March 01, 2008, 09:06:31 AM »


First of all if initialized correctly you do not have to directly call Particles.Render.


Code:
Sub InitParticles
   Scene.DestroyAllParticleSystems
   Set Particles = Scene.CreateParticleSystem
   Particles.Load (App.Path & "\buildings\Powerplant\smoke.tvp")
   Particles.SetGlobalPosition 0, 10, 0
   Particles.Enable True
End Sub

Sub Render()
   Do
      Engine.Clear
      Scene.RenderAll True
      Engine.RenderToScreen
   Loop While doRender
End Sub

This should be all that you need because the Scene object will take care of rendering the Particle system.

Make sure that you use the correct order in your Render loop, as I have shown above.

Also make sure your camera is in the right place to see it.

Last thing, after making corrections and running it - check the debug log for any errors or warnings.
Logged

Project: Eternis Prime
Insomnia
Community Member
*
Posts: 23


WWW
« Reply #19 on: March 01, 2008, 11:23:53 AM »

Aaahh, very nice, that works! Thanks a lot analysis_junky, last question about this one: Is there a possibility to scale the system? Except in the particle editor I mean, like we can scale meshes.
Logged

Pages: [1] 2
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks