|
analysis_junky
|
 |
« 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
|
 |
« 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
|
|
|
|
|
analysis_junky
|
 |
« 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
|
 |
« 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. 
|
|
|
|
|
Logged
|
|
|
|
|
analysis_junky
|
 |
« 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
|
 |
« Reply #5 on: February 07, 2008, 01:55:04 PM » |
|
yeah, the 6.5 Prerelease
|
|
|
|
|
Logged
|
|
|
|
|
analysis_junky
|
 |
« 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
|
 |
« 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
|
 |
« Reply #8 on: February 08, 2008, 03:46:40 PM » |
|
What language ?
|
|
|
|
|
Logged
|
|
|
|
Insomnia
Community Member

Posts: 23
|
 |
« 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
|
 |
« 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 
|
|
|
|
|
Logged
|
|
|
|
Insomnia
Community Member

Posts: 23
|
 |
« Reply #11 on: February 16, 2008, 09:17:33 AM » |
|
Okay this is the definition: Public Particles As New TVParticleSystem Then I try it like in the TVDemo 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: Scene.CreateParticleSystem ("Rauch") Then I want to load the particle effect itself 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: Particles.PreGenerate -1, 32 Particles.SetGlobalPosition 0, 1, 0 Same problem for the shader stuff, these are the equivalent lines: 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 
|
|
|
|
|
Logged
|
|
|
|
|
pizzayoyo
|
 |
« Reply #12 on: February 16, 2008, 02:54:06 PM » |
|
Particles = Scene.CreateParticleSystem("Rauch") In VB6, when setting an object to an instance you must use the keyword set... Set Particles = Scene.CreateParticleSystem("Rauch")
|
|
|
|
|
Logged
|
|
|
|
Insomnia
Community Member

Posts: 23
|
 |
« 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
|
 |
« 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: [...] Scene.DestroyAllParticleSystems Set Particles = Scene.CreateParticleSystem Particles.Load (App.Path & "\buildings\Powerplant\smoke.tvp") Particles.SetGlobalPosition 0, 10, 0 Particles.Enable True [...] Render Loop: [...] Particles.Render [...] Thanks for your help! 
|
|
|
|
|
Logged
|
|
|
|
|
pizzayoyo
|
 |
« 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
|
 |
« Reply #17 on: March 01, 2008, 07:18:01 AM » |
|
Does not change anything either  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
|
 |
« 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. 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
|
 |
« 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
|
|
|
|
|