just out of curiosity, i want to start messing with physics. all the info i have found is about blueprints and mainly about constraining 2 actors together.
however i would like to dig into the core of physx simulation and see what craziness i can come up with.
so very generally, what areas of the source are interesting to play with?
are there any c++ examples around i could take a look at?
yep i did
im using 4.6 and a lot of stuff seems to have changed (so im guessing from the error comments)
heres the errors
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(28): error C3861: 'DrawDebugPoint': identifier not found
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(40): error C2065: 'GEngine' : undeclared identifier
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(40): error C2227: left of '->AddOnScreenDebugMessage' must point to class/struct/union/generic type
1> type is 'unknown-type'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(45): error C2065: 'GEngine' : undeclared identifier
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(45): error C2227: left of '->AddOnScreenDebugMessage' must point to class/struct/union/generic type
1> type is 'unknown-type'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public/MyDestructibleActor.h(28): error C3861: 'DrawDebugPoint': identifier not found
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public/MyDestructibleActor.h(40): error C2065: 'GEngine' : undeclared identifier
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public/MyDestructibleActor.h(40): error C2227: left of '->AddOnScreenDebugMessage' must point to class/struct/union/generic type
1> type is 'unknown-type'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public/MyDestructibleActor.h(45): error C2065: 'GEngine' : undeclared identifier
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public/MyDestructibleActor.h(45): error C2227: left of '->AddOnScreenDebugMessage' must point to class/struct/union/generic type
1> type is 'unknown-type'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(10): warning C4996: FPostConstructInitializeProperties is deprecated and was renamed to FObjectInitializer. Please use that type instead.
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(10): error C2084: function 'AMyDestructibleActor::AMyDestructibleActor(const FObjectInitializer &)' already has a body
1> C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(14) : see previous definition of '{ctor}'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(24): warning C4996: 'ADestructibleActor::DestructibleComponent': DestructibleComponent should not be accessed directly, please use GetDestructibleComponent() function instead. DestructibleComponent will soon be private and your code will not compile. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1> D:\GitHub\UnrealEngine-4.6\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/DestructibleActor.h(25) : see declaration of 'ADestructibleActor::DestructibleComponent'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(24): error C2027: use of undefined type 'UDestructibleComponent'
1> D:\GitHub\UnrealEngine-4.6\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/DestructibleActor.h(9) : see declaration of 'UDestructibleComponent'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(24): error C2227: left of '->ChunkInfos' must point to class/struct/union/generic type
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(26): error C2065: 'Each' : undeclared identifier
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(26): error C2228: left of '.Actor' must have class/struct/union
1> type is 'unknown-type'
1> -------- End Detailed Actions Stats -----------------------------------------------------------
is my code just incase im a complete spaz and cant copy/paste/edit or something
‘PHYSICSMESS_API’ was generated by ue4 when i added the class from the editor, i just added the content from the wiki page
.h
well that certainly cut down the errors thanks,
however
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(10): warning C4996: FPostConstructInitializeProperties is deprecated and was renamed to FObjectInitializer. Please use that type instead.
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(10): error C2084: function 'AMyDestructibleActor::AMyDestructibleActor(const FObjectInitializer &)' already has a body
1> C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Public\MyDestructibleActor.h(14) : see previous definition of '{ctor}'
1>C:\Users\bob\Documents\Unreal Projects\PhysicsMess\Source\PhysicsMess\Private\MyDestructibleActor.cpp(24): warning C4996: 'ADestructibleActor::DestructibleComponent': DestructibleComponent should not be accessed directly, please use GetDestructibleComponent() function instead. DestructibleComponent will soon be private and your code will not compile. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1> D:\GitHub\UnrealEngine-4.6\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/DestructibleActor.h(25) : see declaration of 'ADestructibleActor::DestructibleComponent'
1> D:\GitHub\UnrealEngine-4.6\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/DestructibleActor.h(25) : see declaration of 'ADestructibleActor::DestructibleComponent'
1> -------- End Detailed Actions Stats -----------------------------------------------------------
edit:
after fixing those errors it compiles!!!
is the .cpp that compiles
// Fill out your copyright notice in the Description page of Project Settings.
#include "PhysicsMess.h"
#include "MyDestructibleActor.h"
//~~~~~~~~~~~~~~~~~~~~~~~~
// PhysX
#include "PhysXIncludes.h"
//~~~~~~~~~~~~~~~~~~~~~~~~
//Tick
void AMyDestructibleActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//~~~~~~~~~~~~
//Draw All Centers to the screen!
#if WITH_PHYSX
ScreenMsg("Got into PhysX!!!");
for (FDestructibleChunkInfo& Each : GetDestructibleComponent()->ChunkInfos)
{
physx::PxRigidDynamic* Actor = Each.Actor;
if (Actor)
{
PxTransform Trans = Actor->getGlobalPose();
PxVec3& PxLoc = Trans.p;
FVector Location(PxLoc.x, PxLoc.y, PxLoc.z);
DrawPoint(Location);
ScreenMsg("physx loc", Location.ToString());
}
}
#endif // WITH_PHYSX
}