zoukankan      html  css  js  c++  java
  • [UE4]C++代码操作SplineMesh

    转自:http://aigo.iteye.com/blog/2279503

    void ARaceSpline::OnConstruction(const FTransform& Transform)  
    {  
        for (int32 i = 0; i < mSplineComponent->GetNumSplinePoints() - 1; i++)  
        {  
            USplineMeshComponent* SplineMesh = ConstructObject<USplineMeshComponent>(USplineMeshComponent::StaticClass(), this);  
      
            SplineMesh->bCreatedByConstructionScript = true;  
            SplineMesh->SetMobility(EComponentMobility::Movable);  
            SplineMesh->AttachParent = mSplineComponent;  
      
            //Set the color!  
            UMaterialInstanceDynamic* dynamicMat = UMaterialInstanceDynamic::Create(mSplineMeshMaterial, NULL);  
            dynamicMat->SetVectorParameterValue(TEXT("Color"), FLinearColor(mSegments[i].mColor));  
      
            SplineMesh->bCastDynamicShadow = false;  
            SplineMesh->SetStaticMesh(mGridMesh);  
            SplineMesh->SetMaterial(0, dynamicMat);  
      
            //Width of the mesh   
            SplineMesh->SetStartScale(FVector2D(50, 50));  
            SplineMesh->SetEndScale(FVector2D(50, 50));  
      
            FVector pointLocationStart, pointTangentStart, pointLocationEnd, pointTangentEnd;  
            mSplineComponent->GetLocalLocationAndTangentAtSplinePoint(i, pointLocationStart, pointTangentStart);  
            mSplineComponent->GetLocalLocationAndTangentAtSplinePoint(i + 1, pointLocationEnd, pointTangentEnd);  
      
            SplineMesh->SetStartAndEnd(pointLocationStart, pointTangentStart, pointLocationEnd, pointTangentEnd);  
        }  
      
        RegisterAllComponents();  
    }  
  • 相关阅读:
    sublime配置攻略
    Objective-C代码块语法(block)使用
    [C/C++]_[VS2010来源与UTF8中国字符串转码ANSI问题]
    Android资源管理框架(Asset Manager)简介和学习计划
    ExtJs自学教程(1):从一切API开始
    ORACLE触发特定的解释
    同TextView在不同的显示内容
    :gAudit
    IIS日志分析 MapReduce
    图片存储心得
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/7728140.html
Copyright © 2011-2022 走看看